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

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

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

Powered by Google App Engine
This is Rietveld 408576698