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

Side by Side Diff: chrome/renderer/chrome_render_thread_observer.cc

Issue 2034933002: Make field trials activated in the GPU process be reflected in browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a unit test for child_process_field_trial_syncer.cc Created 4 years, 6 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 (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/renderer/chrome_render_thread_observer.h" 5 #include "chrome/renderer/chrome_render_thread_observer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 base::WeakPtr<ChromeRenderThreadObserver> observer, 229 base::WeakPtr<ChromeRenderThreadObserver> observer,
230 mojo::InterfaceRequest<mojom::ResourceUsageReporter> request) { 230 mojo::InterfaceRequest<mojom::ResourceUsageReporter> request) {
231 new ResourceUsageReporterImpl(observer, std::move(request)); 231 new ResourceUsageReporterImpl(observer, std::move(request));
232 } 232 }
233 233
234 } // namespace 234 } // namespace
235 235
236 bool ChromeRenderThreadObserver::is_incognito_process_ = false; 236 bool ChromeRenderThreadObserver::is_incognito_process_ = false;
237 237
238 ChromeRenderThreadObserver::ChromeRenderThreadObserver() 238 ChromeRenderThreadObserver::ChromeRenderThreadObserver()
239 : field_trial_syncer_(content::RenderThread::Get()), weak_factory_(this) { 239 : field_trial_syncer_(this), weak_factory_(this) {
240 const base::CommandLine& command_line = 240 const base::CommandLine& command_line =
241 *base::CommandLine::ForCurrentProcess(); 241 *base::CommandLine::ForCurrentProcess();
242 242
243 RenderThread* thread = RenderThread::Get(); 243 RenderThread* thread = RenderThread::Get();
244 resource_delegate_.reset(new RendererResourceDelegate()); 244 resource_delegate_.reset(new RendererResourceDelegate());
245 thread->SetResourceDispatcherDelegate(resource_delegate_.get()); 245 thread->SetResourceDispatcherDelegate(resource_delegate_.get());
246 246
247 thread->GetServiceRegistry()->AddService( 247 thread->GetServiceRegistry()->AddService(
248 base::Bind(CreateResourceUsageReporter, weak_factory_.GetWeakPtr())); 248 base::Bind(CreateResourceUsageReporter, weak_factory_.GetWeakPtr()));
249 249
(...skipping 27 matching lines...) Expand all
277 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, 277 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess,
278 OnSetIsIncognitoProcess) 278 OnSetIsIncognitoProcess)
279 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) 279 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup)
280 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules, 280 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules,
281 OnSetContentSettingRules) 281 OnSetContentSettingRules)
282 IPC_MESSAGE_UNHANDLED(handled = false) 282 IPC_MESSAGE_UNHANDLED(handled = false)
283 IPC_END_MESSAGE_MAP() 283 IPC_END_MESSAGE_MAP()
284 return handled; 284 return handled;
285 } 285 }
286 286
287 void ChromeRenderThreadObserver::OnFieldTrialGroupFinalized(
288 const std::string& trial_name,
289 const std::string& group_name) {
290 content::RenderThread::Get()->Send(
291 new ChromeViewHostMsg_FieldTrialActivated(trial_name));
292 }
293
287 void ChromeRenderThreadObserver::OnSetIsIncognitoProcess( 294 void ChromeRenderThreadObserver::OnSetIsIncognitoProcess(
288 bool is_incognito_process) { 295 bool is_incognito_process) {
289 is_incognito_process_ = is_incognito_process; 296 is_incognito_process_ = is_incognito_process;
290 } 297 }
291 298
292 void ChromeRenderThreadObserver::OnSetContentSettingRules( 299 void ChromeRenderThreadObserver::OnSetContentSettingRules(
293 const RendererContentSettingRules& rules) { 300 const RendererContentSettingRules& rules) {
294 content_setting_rules_ = rules; 301 content_setting_rules_ = rules;
295 } 302 }
296 303
297 void ChromeRenderThreadObserver::OnSetFieldTrialGroup( 304 void ChromeRenderThreadObserver::OnSetFieldTrialGroup(
298 const std::string& trial_name, 305 const std::string& trial_name,
299 const std::string& group_name) { 306 const std::string& group_name) {
300 field_trial_syncer_.OnSetFieldTrialGroup(trial_name, group_name); 307 field_trial_syncer_.OnSetFieldTrialGroup(trial_name, group_name);
301 } 308 }
302 309
303 const RendererContentSettingRules* 310 const RendererContentSettingRules*
304 ChromeRenderThreadObserver::content_setting_rules() const { 311 ChromeRenderThreadObserver::content_setting_rules() const {
305 return &content_setting_rules_; 312 return &content_setting_rules_;
306 } 313 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698