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

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

Issue 2282523002: Cleanup by removing thread hop resource throttle code; experiment's over. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove stale include reference. Created 4 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
« no previous file with comments | « chrome/browser/renderer_host/thread_hop_resource_throttle.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h"
6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/location.h"
10 #include "base/metrics/field_trial.h"
11 #include "base/metrics/histogram_macros.h"
12 #include "base/strings/string_util.h"
13 #include "base/time/time.h"
14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/resource_controller.h"
16
17 ThreadHopResourceThrottle::ThreadHopResourceThrottle() : weak_factory_(this) {}
18
19 ThreadHopResourceThrottle::~ThreadHopResourceThrottle() {}
20
21 bool ThreadHopResourceThrottle::IsEnabled() {
22 const std::string group_name =
23 base::FieldTrialList::FindFullName("ThreadHopResourceThrottle");
24 return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
25 }
26
27 void ThreadHopResourceThrottle::WillStartRequest(bool* defer) {
28 *defer = true;
29 ResumeAfterThreadHop();
30 }
31
32 void ThreadHopResourceThrottle::WillRedirectRequest(
33 const net::RedirectInfo& redirect_info,
34 bool* defer) {
35 *defer = true;
36 ResumeAfterThreadHop();
37 }
38
39 void ThreadHopResourceThrottle::WillProcessResponse(bool* defer) {
40 *defer = true;
41 ResumeAfterThreadHop();
42 }
43
44 const char* ThreadHopResourceThrottle::GetNameForLogging() const {
45 return "ThreadHopResourceThrottle";
46 }
47
48 void ThreadHopResourceThrottle::ResumeAfterThreadHop() {
49 content::BrowserThread::PostTaskAndReply(
50 content::BrowserThread::UI, FROM_HERE, base::Bind(&base::DoNothing),
51 base::Bind(&ThreadHopResourceThrottle::Resume, weak_factory_.GetWeakPtr(),
52 base::TimeTicks::Now()));
53 }
54
55 void ThreadHopResourceThrottle::Resume(const base::TimeTicks& time) {
56 UMA_HISTOGRAM_TIMES("Net.ThreadHopResourceThrottleTime",
57 base::TimeTicks::Now() - time);
58 controller()->Resume();
59 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/thread_hop_resource_throttle.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698