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

Side by Side Diff: content/browser/appcache/appcache_url_request_job.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_url_request_job.h" 5 #include "content/browser/appcache/appcache_url_request_job.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/location.h"
14 #include "base/single_thread_task_runner.h"
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/thread_task_runner_handle.h"
16 #include "content/browser/appcache/appcache.h" 18 #include "content/browser/appcache/appcache.h"
17 #include "content/browser/appcache/appcache_group.h" 19 #include "content/browser/appcache/appcache_group.h"
18 #include "content/browser/appcache/appcache_histograms.h" 20 #include "content/browser/appcache/appcache_histograms.h"
19 #include "content/browser/appcache/appcache_host.h" 21 #include "content/browser/appcache/appcache_host.h"
20 #include "content/browser/appcache/appcache_service_impl.h" 22 #include "content/browser/appcache/appcache_service_impl.h"
21 #include "net/base/io_buffer.h" 23 #include "net/base/io_buffer.h"
22 #include "net/base/net_errors.h" 24 #include "net/base/net_errors.h"
23 #include "net/http/http_request_headers.h" 25 #include "net/http/http_request_headers.h"
24 #include "net/http/http_response_headers.h" 26 #include "net/http/http_response_headers.h"
25 #include "net/http/http_util.h" 27 #include "net/http/http_util.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 DCHECK(!has_delivery_orders()); 74 DCHECK(!has_delivery_orders());
73 delivery_type_ = ERROR_DELIVERY; 75 delivery_type_ = ERROR_DELIVERY;
74 storage_ = NULL; // not needed 76 storage_ = NULL; // not needed
75 MaybeBeginDelivery(); 77 MaybeBeginDelivery();
76 } 78 }
77 79
78 void AppCacheURLRequestJob::MaybeBeginDelivery() { 80 void AppCacheURLRequestJob::MaybeBeginDelivery() {
79 if (has_been_started() && has_delivery_orders()) { 81 if (has_been_started() && has_delivery_orders()) {
80 // Start asynchronously so that all error reporting and data 82 // Start asynchronously so that all error reporting and data
81 // callbacks happen as they would for network requests. 83 // callbacks happen as they would for network requests.
82 base::MessageLoop::current()->PostTask( 84 base::ThreadTaskRunnerHandle::Get()->PostTask(
83 FROM_HERE, 85 FROM_HERE, base::Bind(&AppCacheURLRequestJob::BeginDelivery,
84 base::Bind(&AppCacheURLRequestJob::BeginDelivery, 86 weak_factory_.GetWeakPtr()));
85 weak_factory_.GetWeakPtr()));
86 } 87 }
87 } 88 }
88 89
89 void AppCacheURLRequestJob::BeginDelivery() { 90 void AppCacheURLRequestJob::BeginDelivery() {
90 DCHECK(has_delivery_orders() && has_been_started()); 91 DCHECK(has_delivery_orders() && has_been_started());
91 92
92 if (has_been_killed()) 93 if (has_been_killed())
93 return; 94 return;
94 95
95 switch (delivery_type_) { 96 switch (delivery_type_) {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 return; 441 return;
441 } 442 }
442 443
443 // If multiple ranges are requested, we play dumb and 444 // If multiple ranges are requested, we play dumb and
444 // return the entire response with 200 OK. 445 // return the entire response with 200 OK.
445 if (ranges.size() == 1U) 446 if (ranges.size() == 1U)
446 range_requested_ = ranges[0]; 447 range_requested_ = ranges[0];
447 } 448 }
448 449
449 } // namespace content 450 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698