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

Side by Side Diff: chrome/browser/loader/safe_browsing_resource_throttle.cc

Issue 2542373002: RB-B P1 issue: Add debug aliases for state_ and urls to debug CHECK failures (Closed)
Patch Set: Alias the right way Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/loader/safe_browsing_resource_throttle.h" 5 #include "chrome/browser/loader/safe_browsing_resource_throttle.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/debug/alias.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
12 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/prerender/prerender_contents.h" 16 #include "chrome/browser/prerender/prerender_contents.h"
16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 17 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
17 #include "components/safe_browsing_db/util.h" 18 #include "components/safe_browsing_db/util.h"
18 #include "components/safe_browsing_db/v4_feature_list.h" 19 #include "components/safe_browsing_db/v4_feature_list.h"
19 #include "components/safe_browsing_db/v4_local_database_manager.h" 20 #include "components/safe_browsing_db/v4_local_database_manager.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 return "SafeBrowsingResourceThrottle"; 227 return "SafeBrowsingResourceThrottle";
227 } 228 }
228 229
229 // SafeBrowsingService::Client implementation, called on the IO thread once 230 // SafeBrowsingService::Client implementation, called on the IO thread once
230 // the URL has been classified. 231 // the URL has been classified.
231 void SafeBrowsingResourceThrottle::OnCheckBrowseUrlResult( 232 void SafeBrowsingResourceThrottle::OnCheckBrowseUrlResult(
232 const GURL& url, 233 const GURL& url,
233 safe_browsing::SBThreatType threat_type, 234 safe_browsing::SBThreatType threat_type,
234 const safe_browsing::ThreatMetadata& metadata) { 235 const safe_browsing::ThreatMetadata& metadata) {
235 CHECK_EQ(state_, STATE_CHECKING_URL); 236 CHECK_EQ(state_, STATE_CHECKING_URL);
237 // TODO(vakh): The following base::debug::Alias() and CHECK calls should be
238 // removed after http://crbug.com/660293 is fixed.
236 CHECK(url.is_valid()); 239 CHECK(url.is_valid());
237 CHECK(url_being_checked_.is_valid()); 240 CHECK(url_being_checked_.is_valid());
238 CHECK_EQ(url, url_being_checked_); 241 if (url != url_being_checked_) {
242 char debug_url_buf[2000], debug_url_checked_buf[2000];
243 base::strlcpy(debug_url_buf, url.spec().c_str(), arraysize(debug_url_buf));
244 base::debug::Alias(&debug_url_buf);
245 base::strlcpy(debug_url_checked_buf, url_being_checked_.spec().c_str(),
246 arraysize(debug_url_checked_buf));
247 base::debug::Alias(&debug_url_checked_buf);
Scott Hess - ex-Googler 2016/12/02 23:21:13 Suggestion: Put something easy to search for in th
vakh (use Gerrit instead) 2016/12/02 23:30:37 Done.
248 DVLOG(1) << "debug_url_buf: " << debug_url_buf;
249 DVLOG(1) << "debug_url_checked_buf: " << debug_url_checked_buf;
Scott Hess - ex-Googler 2016/12/02 23:21:13 Do you run a long-term browser with settings that
vakh (use Gerrit instead) 2016/12/02 23:30:37 Yes, was planning on running the browser but I als
250 CHECK(false);
251 }
239 252
240 timer_.Stop(); // Cancel the timeout timer. 253 timer_.Stop(); // Cancel the timeout timer.
241 threat_type_ = threat_type; 254 threat_type_ = threat_type;
242 state_ = STATE_NONE; 255 state_ = STATE_NONE;
243 256
244 if (defer_state_ != DEFERRED_NONE) { 257 if (defer_state_ != DEFERRED_NONE) {
245 EndNetLogEvent(NetLogEventType::SAFE_BROWSING_DEFERRED, nullptr, nullptr); 258 EndNetLogEvent(NetLogEventType::SAFE_BROWSING_DEFERRED, nullptr, nullptr);
246 } 259 }
247 EndNetLogEvent( 260 EndNetLogEvent(
248 NetLogEventType::SAFE_BROWSING_CHECKING_URL, "result", 261 NetLogEventType::SAFE_BROWSING_CHECKING_URL, "result",
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 unchecked_redirect_url_, "defer_reason", 442 unchecked_redirect_url_, "defer_reason",
430 "resumed_redirect"); 443 "resumed_redirect");
431 } 444 }
432 } 445 }
433 446
434 if (resume) { 447 if (resume) {
435 defer_state_ = DEFERRED_NONE; 448 defer_state_ = DEFERRED_NONE;
436 controller()->Resume(); 449 controller()->Resume();
437 } 450 }
438 } 451 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698