Changeset 47845 in webkit for trunk/JavaScriptCore/wtf


Ignore:
Timestamp:
Aug 27, 2009, 5:11:22 PM (16 years ago)
Author:
[email protected]
Message:

Reviewed by Oliver Hunt.

https://bugs.webkit.org/show_bug.cgi?id=28753
<rdar://problem/7173448> Excessive number of threads (and a crash)

Coalesce DNS prefetch requests to reduce strain on CFHost. Currently, the algorithm is as follows:

  • when resolver is idle, the first few requests are sent immediately (they may or may not hit the wire);
  • if there are a few requests in flight already, coalesce all requests for one second;
  • to avoid pathological cases with lots of links to different sites on a page, only ask CFHost about a handful of names (dropping the rest).

Coalescing reduces the number of requests dramatically, as prefetchDNS is called for each
link, and these tend to have identical host name.

  • platform/network/cf/DNSCFNet.cpp: (WebCore::DNSResolveQueue::DNSResolveQueue): (WebCore::DNSResolveQueue::shared): (WebCore::DNSResolveQueue::add): (WebCore::DNSResolveQueue::decrementRequestCount): (WebCore::DNSResolveQueue::fired): (WebCore::clientCallback): (WebCore::DNSResolveQueue::resolve): (WebCore::prefetchDNS):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/Threading.h

    r46683 r47845  
    216216
    217217#if COMPILER(MINGW) || COMPILER(MSVC7) || PLATFORM(WINCE)
    218 inline void atomicIncrement(int* addend) { InterlockedIncrement(reinterpret_cast<long*>(addend)); }
     218inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpret_cast<long*>(addend)); }
    219219inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpret_cast<long*>(addend)); }
    220220#else
    221 inline void atomicIncrement(int volatile* addend) { InterlockedIncrement(reinterpret_cast<long volatile*>(addend)); }
     221inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(reinterpret_cast<long volatile*>(addend)); }
    222222inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast<long volatile*>(addend)); }
    223223#endif
     
    226226#define WTF_USE_LOCKFREE_THREADSAFESHARED 1
    227227
    228 inline void atomicIncrement(int volatile* addend) { OSAtomicIncrement32Barrier(const_cast<int*>(addend)); }
     228inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast<int*>(addend)); }
    229229inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast<int*>(addend)); }
    230230
     
    232232#define WTF_USE_LOCKFREE_THREADSAFESHARED 1
    233233
    234 inline void atomicIncrement(int volatile* addend) { __gnu_cxx::__atomic_add(addend, 1); }
     234inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; }
    235235inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, -1) - 1; }
    236236
     
    326326using WTF::ThreadSafeShared;
    327327
     328using WTF::atomicDecrement;
     329using WTF::atomicIncrement;
    328330using WTF::createThread;
    329331using WTF::currentThread;
Note: See TracChangeset for help on using the changeset viewer.