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

Side by Side Diff: chrome/browser/renderer_host/safe_browsing_resource_handler.cc

Issue 18390: Change URLRequest to use a ref-counted buffer for actual IO.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/safe_browsing_resource_handler.h" 5 #include "chrome/browser/renderer_host/safe_browsing_resource_handler.h"
6 6
7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
8 8
9 // Maximum time to wait for a gethash response from the Safe Browsing servers. 9 // Maximum time to wait for a gethash response from the Safe Browsing servers.
10 static const int kMaxGetHashMs = 1000; 10 static const int kMaxGetHashMs = 1000;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 void SafeBrowsingResourceHandler::OnGetHashTimeout() { 71 void SafeBrowsingResourceHandler::OnGetHashTimeout() {
72 if (!in_safe_browsing_check_) 72 if (!in_safe_browsing_check_)
73 return; 73 return;
74 74
75 safe_browsing_->CancelCheck(this); 75 safe_browsing_->CancelCheck(this);
76 OnUrlCheckResult(GURL::EmptyGURL(), SafeBrowsingService::URL_SAFE); 76 OnUrlCheckResult(GURL::EmptyGURL(), SafeBrowsingService::URL_SAFE);
77 } 77 }
78 78
79 bool SafeBrowsingResourceHandler::OnWillRead(int request_id, 79 bool SafeBrowsingResourceHandler::OnWillRead(int request_id,
80 char** buf, int* buf_size, 80 net::IOBuffer** buf, int* buf_size,
81 int min_size) { 81 int min_size) {
82 if (in_safe_browsing_check_ && pause_time_.is_null()) { 82 if (in_safe_browsing_check_ && pause_time_.is_null()) {
83 pause_time_ = base::Time::Now(); 83 pause_time_ = base::Time::Now();
84 MessageLoop::current()->PostDelayedTask( 84 MessageLoop::current()->PostDelayedTask(
85 FROM_HERE, 85 FROM_HERE,
86 NewRunnableMethod(this, &SafeBrowsingResourceHandler::OnGetHashTimeout), 86 NewRunnableMethod(this, &SafeBrowsingResourceHandler::OnGetHashTimeout),
87 kMaxGetHashMs); 87 kMaxGetHashMs);
88 } 88 }
89 89
90 if (in_safe_browsing_check_ || displaying_blocking_page_) { 90 if (in_safe_browsing_check_ || displaying_blocking_page_) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 next_handler_->OnResponseCompleted( 170 next_handler_->OnResponseCompleted(
171 queued_error_request_id_, *queued_error_.get()); 171 queued_error_request_id_, *queued_error_.get());
172 queued_error_.reset(); 172 queued_error_.reset();
173 } 173 }
174 } else { 174 } else {
175 rdh_->CancelRequest(render_process_host_id_, paused_request_id_, false); 175 rdh_->CancelRequest(render_process_host_id_, paused_request_id_, false);
176 } 176 }
177 177
178 Release(); 178 Release();
179 } 179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698