Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: content/browser/appcache/appcache_response.cc

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test build fix. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/appcache/appcache_response.h" 5 #include "content/browser/appcache/appcache_response.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/location.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h"
12 #include "base/numerics/safe_math.h" 12 #include "base/numerics/safe_math.h"
13 #include "base/pickle.h" 13 #include "base/pickle.h"
14 #include "base/profiler/scoped_tracker.h" 14 #include "base/profiler/scoped_tracker.h"
15 #include "base/single_thread_task_runner.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/thread_task_runner_handle.h"
16 #include "content/browser/appcache/appcache_storage.h" 18 #include "content/browser/appcache/appcache_storage.h"
17 #include "net/base/completion_callback.h" 19 #include "net/base/completion_callback.h"
18 #include "net/base/io_buffer.h" 20 #include "net/base/io_buffer.h"
19 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
20 22
21 namespace content { 23 namespace content {
22 24
23 namespace { 25 namespace {
24 26
25 // Disk cache entry data indices. 27 // Disk cache entry data indices.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 buffer_len_(0), 85 buffer_len_(0),
84 weak_factory_(this) { 86 weak_factory_(this) {
85 } 87 }
86 88
87 AppCacheResponseIO::~AppCacheResponseIO() { 89 AppCacheResponseIO::~AppCacheResponseIO() {
88 if (entry_) 90 if (entry_)
89 entry_->Close(); 91 entry_->Close();
90 } 92 }
91 93
92 void AppCacheResponseIO::ScheduleIOCompletionCallback(int result) { 94 void AppCacheResponseIO::ScheduleIOCompletionCallback(int result) {
93 base::MessageLoop::current()->PostTask( 95 base::ThreadTaskRunnerHandle::Get()->PostTask(
94 FROM_HERE, base::Bind(&AppCacheResponseIO::OnIOComplete, 96 FROM_HERE, base::Bind(&AppCacheResponseIO::OnIOComplete,
95 weak_factory_.GetWeakPtr(), result)); 97 weak_factory_.GetWeakPtr(), result));
96 } 98 }
97 99
98 void AppCacheResponseIO::InvokeUserCompletionCallback(int result) { 100 void AppCacheResponseIO::InvokeUserCompletionCallback(int result) {
99 // Clear the user callback and buffers prior to invoking the callback 101 // Clear the user callback and buffers prior to invoking the callback
100 // so the caller can schedule additional operations in the callback. 102 // so the caller can schedule additional operations in the callback.
101 buffer_ = NULL; 103 buffer_ = NULL;
102 info_buffer_ = NULL; 104 info_buffer_ = NULL;
103 net::CompletionCallback cb = callback_; 105 net::CompletionCallback cb = callback_;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 477 }
476 WriteRaw(kResponseMetadataIndex, 0, buffer_.get(), write_amount_); 478 WriteRaw(kResponseMetadataIndex, 0, buffer_.get(), write_amount_);
477 } 479 }
478 480
479 void AppCacheResponseMetadataWriter::OnIOComplete(int result) { 481 void AppCacheResponseMetadataWriter::OnIOComplete(int result) {
480 DCHECK(result < 0 || write_amount_ == result); 482 DCHECK(result < 0 || write_amount_ == result);
481 InvokeUserCompletionCallback(result); 483 InvokeUserCompletionCallback(result);
482 } 484 }
483 485
484 } // namespace content 486 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_request_handler_unittest.cc ('k') | content/browser/appcache/appcache_response_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698