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

Side by Side Diff: chrome/browser/prerender/prerender_manager.cc

Issue 8537021: Add information to net-internals if the user is in the no-use group. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding more info to net-internals for Prerendering experimental groups. Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/prerender/prerender_manager.h ('k') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/prerender/prerender_manager.h" 5 #include "chrome/browser/prerender/prerender_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 GetMode() == PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP || 128 GetMode() == PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP ||
129 GetMode() == PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP; 129 GetMode() == PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP;
130 } 130 }
131 131
132 // static 132 // static
133 bool PrerenderManager::IsControlGroup() { 133 bool PrerenderManager::IsControlGroup() {
134 return GetMode() == PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP; 134 return GetMode() == PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP;
135 } 135 }
136 136
137 // static 137 // static
138 bool PrerenderManager::IsNoUseGroup() {
139 return GetMode() == PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP;
140 }
141
142 // static
138 bool PrerenderManager::IsValidHttpMethod(const std::string& method) { 143 bool PrerenderManager::IsValidHttpMethod(const std::string& method) {
139 // method has been canonicalized to upper case at this point so we can just 144 // method has been canonicalized to upper case at this point so we can just
140 // compare them. 145 // compare them.
141 DCHECK_EQ(method, StringToUpperASCII(method)); 146 DCHECK_EQ(method, StringToUpperASCII(method));
142 for (size_t i = 0; i < arraysize(kValidHttpMethods); ++i) { 147 for (size_t i = 0; i < arraysize(kValidHttpMethods); ++i) {
143 if (method.compare(kValidHttpMethods[i]) == 0) 148 if (method.compare(kValidHttpMethods[i]) == 0)
144 return true; 149 return true;
145 } 150 }
146 151
147 return false; 152 return false;
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 dict_value->SetString("omnibox_heuristic", "(exact)"); 988 dict_value->SetString("omnibox_heuristic", "(exact)");
984 break; 989 break;
985 default: 990 default:
986 NOTREACHED(); 991 NOTREACHED();
987 break; 992 break;
988 } 993 }
989 } 994 }
990 // If prerender is disabled via a flag this method is not even called. 995 // If prerender is disabled via a flag this method is not even called.
991 if (IsControlGroup()) 996 if (IsControlGroup())
992 dict_value->SetString("disabled_reason", "(Disabled for testing)"); 997 dict_value->SetString("disabled_reason", "(Disabled for testing)");
998 if (IsNoUseGroup())
999 dict_value->SetString("disabled_reason", "(Not using prerendered pages)");
993 return dict_value; 1000 return dict_value;
994 } 1001 }
995 1002
996 void PrerenderManager::ClearData(int clear_flags) { 1003 void PrerenderManager::ClearData(int clear_flags) {
997 DCHECK_GE(clear_flags, 0); 1004 DCHECK_GE(clear_flags, 0);
998 DCHECK_LT(clear_flags, CLEAR_MAX); 1005 DCHECK_LT(clear_flags, CLEAR_MAX);
999 if (clear_flags & CLEAR_PRERENDER_CONTENTS) 1006 if (clear_flags & CLEAR_PRERENDER_CONTENTS)
1000 DestroyAllContents(FINAL_STATUS_CACHE_OR_HISTORY_CLEARED); 1007 DestroyAllContents(FINAL_STATUS_CACHE_OR_HISTORY_CLEARED);
1001 // This has to be second, since destroying prerenders can add to the history. 1008 // This has to be second, since destroying prerenders can add to the history.
1002 if (clear_flags & CLEAR_PRERENDER_HISTORY) 1009 if (clear_flags & CLEAR_PRERENDER_HISTORY)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 if (!render_process_host || !render_process_host->browser_context()) 1066 if (!render_process_host || !render_process_host->browser_context())
1060 return NULL; 1067 return NULL;
1061 Profile* profile = Profile::FromBrowserContext( 1068 Profile* profile = Profile::FromBrowserContext(
1062 render_process_host->browser_context()); 1069 render_process_host->browser_context());
1063 if (!profile) 1070 if (!profile)
1064 return NULL; 1071 return NULL;
1065 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); 1072 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile);
1066 } 1073 }
1067 1074
1068 } // namespace prerender 1075 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698