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

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

Issue 700953002: Send all field trials from the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@finch4
Patch Set: Responded to comments. Created 6 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
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_process_observer.h" 5 #include "chrome/renderer/chrome_render_process_observer.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/allocator/allocator_extension.h" 10 #include "base/allocator/allocator_extension.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // after we engage the sandbox. 292 // after we engage the sandbox.
293 if (!command_line.HasSwitch(switches::kSingleProcess)) 293 if (!command_line.HasSwitch(switches::kSingleProcess))
294 crypto::InitNSSSafely(); 294 crypto::InitNSSSafely();
295 #elif defined(OS_WIN) 295 #elif defined(OS_WIN)
296 // crypt32.dll is used to decode X509 certificates for Chromoting. 296 // crypt32.dll is used to decode X509 certificates for Chromoting.
297 // Only load this library when the feature is enabled. 297 // Only load this library when the feature is enabled.
298 base::LoadNativeLibrary(base::FilePath(L"crypt32.dll"), NULL); 298 base::LoadNativeLibrary(base::FilePath(L"crypt32.dll"), NULL);
299 #endif 299 #endif
300 // Setup initial set of crash dump data for Field Trials in this renderer. 300 // Setup initial set of crash dump data for Field Trials in this renderer.
301 chrome_variations::SetChildProcessLoggingVariationList(); 301 chrome_variations::SetChildProcessLoggingVariationList();
302 // Report any field trials activations to the browser.
Alexei Svitkine (slow) 2014/11/05 22:50:53 Nit: I would make the comment say "// Listen for f
Georges Khalil 2014/11/06 18:36:28 Done.
303 base::FieldTrialList::AddObserver(this);
302 } 304 }
303 305
304 ChromeRenderProcessObserver::~ChromeRenderProcessObserver() { 306 ChromeRenderProcessObserver::~ChromeRenderProcessObserver() {
305 } 307 }
306 308
307 bool ChromeRenderProcessObserver::OnControlMessageReceived( 309 bool ChromeRenderProcessObserver::OnControlMessageReceived(
308 const IPC::Message& message) { 310 const IPC::Message& message) {
309 bool handled = true; 311 bool handled = true;
310 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) 312 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message)
311 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, 313 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 RenderThread::Get()->Send(new ChromeViewHostMsg_ResourceTypeStats(stats)); 360 RenderThread::Get()->Send(new ChromeViewHostMsg_ResourceTypeStats(stats));
359 } 361 }
360 362
361 void ChromeRenderProcessObserver::OnSetFieldTrialGroup( 363 void ChromeRenderProcessObserver::OnSetFieldTrialGroup(
362 const std::string& field_trial_name, 364 const std::string& field_trial_name,
363 const std::string& group_name) { 365 const std::string& group_name) {
364 base::FieldTrial* trial = 366 base::FieldTrial* trial =
365 base::FieldTrialList::CreateFieldTrial(field_trial_name, group_name); 367 base::FieldTrialList::CreateFieldTrial(field_trial_name, group_name);
366 // TODO(mef): Remove this check after the investigation of 359406 is complete. 368 // TODO(mef): Remove this check after the investigation of 359406 is complete.
367 CHECK(trial) << field_trial_name << ":" << group_name; 369 CHECK(trial) << field_trial_name << ":" << group_name;
368 // Ensure the trial is marked as "used" by calling group() on it. This is 370 // Ensure the trial is marked as "used" by calling group() on it if it is
369 // needed to ensure the trial is properly reported in renderer crash reports. 371 // marked as activated.
370 trial->group(); 372 trial->group();
371 chrome_variations::SetChildProcessLoggingVariationList(); 373 chrome_variations::SetChildProcessLoggingVariationList();
372 } 374 }
373 375
374 void ChromeRenderProcessObserver::OnGetV8HeapStats() { 376 void ChromeRenderProcessObserver::OnGetV8HeapStats() {
375 HeapStatisticsCollector::Instance()->InitiateCollection(); 377 HeapStatisticsCollector::Instance()->InitiateCollection();
376 } 378 }
377 379
378 const RendererContentSettingRules* 380 const RendererContentSettingRules*
379 ChromeRenderProcessObserver::content_setting_rules() const { 381 ChromeRenderProcessObserver::content_setting_rules() const {
380 return &content_setting_rules_; 382 return &content_setting_rules_;
381 } 383 }
384
385 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized(
386 const std::string& trial_name,
387 const std::string& group_name) {
388 content::RenderThread::Get()->Send(
389 new ChromeViewHostMsg_FieldTrialActivated(trial_name, group_name));
390 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698