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

Side by Side Diff: content/browser/loader/detachable_resource_handler.cc

Issue 1355063004: Template methods on Timer classes instead of the classes themselves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timer: fixcaller Created 5 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/loader/detachable_resource_handler.h" 5 #include "content/browser/loader/detachable_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "content/browser/loader/resource_request_info_impl.h" 9 #include "content/browser/loader/resource_request_info_impl.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 // A OnWillRead / OnReadCompleted pair may still be in progress, but 57 // A OnWillRead / OnReadCompleted pair may still be in progress, but
58 // OnWillRead passes back a scoped_refptr, so downstream handler's buffer will 58 // OnWillRead passes back a scoped_refptr, so downstream handler's buffer will
59 // survive long enough to complete that read. From there, future reads will 59 // survive long enough to complete that read. From there, future reads will
60 // drain into |read_buffer_|. (If |next_handler_| is an AsyncResourceHandler, 60 // drain into |read_buffer_|. (If |next_handler_| is an AsyncResourceHandler,
61 // the net::IOBuffer takes a reference to the ResourceBuffer which owns the 61 // the net::IOBuffer takes a reference to the ResourceBuffer which owns the
62 // shared memory.) 62 // shared memory.)
63 next_handler_.reset(); 63 next_handler_.reset();
64 64
65 // Time the request out if it takes too long. 65 // Time the request out if it takes too long.
66 detached_timer_.reset(new base::OneShotTimer<DetachableResourceHandler>()); 66 detached_timer_.reset(new base::OneShotTimer());
67 detached_timer_->Start( 67 detached_timer_->Start(
68 FROM_HERE, cancel_delay_, this, &DetachableResourceHandler::Cancel); 68 FROM_HERE, cancel_delay_, this, &DetachableResourceHandler::Cancel);
69 69
70 // Resume if necessary. The request may have been deferred, say, waiting on a 70 // Resume if necessary. The request may have been deferred, say, waiting on a
71 // full buffer in AsyncResourceHandler. Now that it has been detached, resume 71 // full buffer in AsyncResourceHandler. Now that it has been detached, resume
72 // and drain it. 72 // and drain it.
73 if (is_deferred_) { 73 if (is_deferred_) {
74 // The nested ResourceHandler may have logged that it's blocking the 74 // The nested ResourceHandler may have logged that it's blocking the
75 // request. Log it as no longer doing so, to avoid a DCHECK on resume. 75 // request. Log it as no longer doing so, to avoid a DCHECK on resume.
76 request()->LogUnblocked(); 76 request()->LogUnblocked();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 void DetachableResourceHandler::CancelAndIgnore() { 202 void DetachableResourceHandler::CancelAndIgnore() {
203 controller()->CancelAndIgnore(); 203 controller()->CancelAndIgnore();
204 } 204 }
205 205
206 void DetachableResourceHandler::CancelWithError(int error_code) { 206 void DetachableResourceHandler::CancelWithError(int error_code) {
207 controller()->CancelWithError(error_code); 207 controller()->CancelWithError(error_code);
208 } 208 }
209 209
210 } // namespace content 210 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/detachable_resource_handler.h ('k') | content/browser/loader/power_save_block_resource_throttle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698