diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-03 13:42:47 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-15 10:27:51 +0000 |
commit | 8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (patch) | |
tree | d29d987c4d7b173cf853279b79a51598f104b403 /chromium/net/http/mock_http_cache.cc | |
parent | 830c9e163d31a9180fadca926b3e1d7dfffb5021 (diff) | |
download | qtwebengine-chromium-8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec.tar.gz |
BASELINE: Update Chromium to 66.0.3359.156
Change-Id: I0c9831ad39911a086b6377b16f995ad75a51e441
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/net/http/mock_http_cache.cc')
-rw-r--r-- | chromium/net/http/mock_http_cache.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/chromium/net/http/mock_http_cache.cc b/chromium/net/http/mock_http_cache.cc index 8c940f3bde4..ad730d1e04c 100644 --- a/chromium/net/http/mock_http_cache.cc +++ b/chromium/net/http/mock_http_cache.cc @@ -4,11 +4,13 @@ #include "net/http/mock_http_cache.h" +#include <algorithm> #include <limits> #include <memory> #include <utility> #include "base/bind.h" +#include "base/callback_helpers.h" #include "base/location.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" @@ -174,6 +176,13 @@ int MockDiskEntry::WriteData(int index, if (MockHttpCache::GetTestMode(test_mode_) & TEST_MODE_SYNC_CACHE_WRITE) return buf_len; + if (defer_op_ == DEFER_WRITE) { + defer_op_ = DEFER_NONE; + resume_callback_ = callback; + resume_return_code_ = buf_len; + return ERR_IO_PENDING; + } + CallbackLater(callback, buf_len); return ERR_IO_PENDING; } @@ -800,9 +809,8 @@ void MockBlockingBackendFactory::FinishCreation() { if (!callback_.is_null()) { if (!fail_) backend_->reset(new MockDiskCache()); - CompletionCallback cb = callback_; - callback_.Reset(); - cb.Run(Result()); // This object can be deleted here. + // Running the callback might delete |this|. + base::ResetAndReturn(&callback_).Run(Result()); } } |