Changeset 186510 in webkit


Ignore:
Timestamp:
Jul 8, 2015, 10:02:54 AM (10 years ago)
Author:
Antti Koivisto
Message:

Network Cache: Don't open files in main thread
https://bugs.webkit.org/show_bug.cgi?id=146722

Reviewed by Chris Dumez.

While we use open() with O_NONBLOCK profiling indicates that we still may block up to 5ms under the syscall in some case.

  • NetworkProcess/cache/NetworkCacheStorage.cpp:

(WebKit::NetworkCache::Storage::dispatchReadOperation):

Dispatch read operation to a concurrent queue.
With this we can also eliminate the separate dispatch() for body blob read.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r186495 r186510  
     12015-07-08  Antti Koivisto  <antti@apple.com>
     2
     3        Network Cache: Don't open files in main thread
     4        https://bugs.webkit.org/show_bug.cgi?id=146722
     5
     6        Reviewed by Chris Dumez.
     7
     8        While we use open() with O_NONBLOCK profiling indicates that we still may block up to 5ms under the syscall in some case.
     9
     10        * NetworkProcess/cache/NetworkCacheStorage.cpp:
     11        (WebKit::NetworkCache::Storage::dispatchReadOperation):
     12
     13            Dispatch read operation to a concurrent queue.
     14            With this we can also eliminate the separate dispatch() for body blob read.
     15
    1162015-07-08  Sungmann Cho  <sungmann.cho@navercorp.com>
    217
  • trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp

    r186224 r186510  
    486486    ASSERT(m_activeReadOperations.contains(&readOperation));
    487487
    488     auto recordPath = recordPathForKey(readOperation.key);
    489 
    490     ++readOperation.activeCount;
    491 
    492     bool shouldGetBodyBlob = !m_bodyFilter || m_bodyFilter->mayContain(readOperation.key.hash());
    493     if (shouldGetBodyBlob)
     488    ioQueue().dispatch([this, &readOperation] {
     489        auto recordPath = recordPathForKey(readOperation.key);
     490
    494491        ++readOperation.activeCount;
    495492
    496     RefPtr<IOChannel> channel = IOChannel::open(recordPath, IOChannel::Type::Read);
    497     channel->read(0, std::numeric_limits<size_t>::max(), &ioQueue(), [this, &readOperation](const Data& fileData, int error) {
    498         if (!error)
    499             readRecord(readOperation, fileData);
    500         finishReadOperation(readOperation);
    501     });
    502 
    503     if (!shouldGetBodyBlob)
    504         return;
    505 
    506     // Read the body blob in parallel with the record read.
    507     ioQueue().dispatch([this, &readOperation] {
    508         auto bodyPath = bodyPathForKey(readOperation.key);
    509         readOperation.resultBodyBlob = m_blobStorage.get(bodyPath);
    510         finishReadOperation(readOperation);
     493        bool shouldGetBodyBlob = !m_bodyFilter || m_bodyFilter->mayContain(readOperation.key.hash());
     494        if (shouldGetBodyBlob)
     495            ++readOperation.activeCount;
     496
     497        auto channel = IOChannel::open(recordPath, IOChannel::Type::Read);
     498        channel->read(0, std::numeric_limits<size_t>::max(), &ioQueue(), [this, &readOperation](const Data& fileData, int error) {
     499            if (!error)
     500                readRecord(readOperation, fileData);
     501            finishReadOperation(readOperation);
     502        });
     503
     504        if (shouldGetBodyBlob) {
     505            // Read the body blob in parallel with the record read.
     506            auto bodyPath = bodyPathForKey(readOperation.key);
     507            readOperation.resultBodyBlob = m_blobStorage.get(bodyPath);
     508            finishReadOperation(readOperation);
     509        }
    511510    });
    512511}
Note: See TracChangeset for help on using the changeset viewer.