OLD | NEW |
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // after we engage the sandbox. | 298 // after we engage the sandbox. |
299 if (!command_line.HasSwitch(switches::kSingleProcess)) | 299 if (!command_line.HasSwitch(switches::kSingleProcess)) |
300 crypto::InitNSSSafely(); | 300 crypto::InitNSSSafely(); |
301 #elif defined(OS_WIN) | 301 #elif defined(OS_WIN) |
302 // crypt32.dll is used to decode X509 certificates for Chromoting. | 302 // crypt32.dll is used to decode X509 certificates for Chromoting. |
303 // Only load this library when the feature is enabled. | 303 // Only load this library when the feature is enabled. |
304 base::LoadNativeLibrary(base::FilePath(L"crypt32.dll"), NULL); | 304 base::LoadNativeLibrary(base::FilePath(L"crypt32.dll"), NULL); |
305 #endif | 305 #endif |
306 // Setup initial set of crash dump data for Field Trials in this renderer. | 306 // Setup initial set of crash dump data for Field Trials in this renderer. |
307 chrome_variations::SetChildProcessLoggingVariationList(); | 307 chrome_variations::SetChildProcessLoggingVariationList(); |
| 308 // Listen for field trial activations to report them to the browser. |
| 309 base::FieldTrialList::AddObserver(this); |
308 } | 310 } |
309 | 311 |
310 ChromeRenderProcessObserver::~ChromeRenderProcessObserver() { | 312 ChromeRenderProcessObserver::~ChromeRenderProcessObserver() { |
311 } | 313 } |
312 | 314 |
313 bool ChromeRenderProcessObserver::OnControlMessageReceived( | 315 bool ChromeRenderProcessObserver::OnControlMessageReceived( |
314 const IPC::Message& message) { | 316 const IPC::Message& message) { |
315 bool handled = true; | 317 bool handled = true; |
316 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) | 318 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) |
317 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, | 319 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 RenderThread::Get()->Send(new ChromeViewHostMsg_ResourceTypeStats(stats)); | 366 RenderThread::Get()->Send(new ChromeViewHostMsg_ResourceTypeStats(stats)); |
365 } | 367 } |
366 | 368 |
367 void ChromeRenderProcessObserver::OnSetFieldTrialGroup( | 369 void ChromeRenderProcessObserver::OnSetFieldTrialGroup( |
368 const std::string& field_trial_name, | 370 const std::string& field_trial_name, |
369 const std::string& group_name) { | 371 const std::string& group_name) { |
370 base::FieldTrial* trial = | 372 base::FieldTrial* trial = |
371 base::FieldTrialList::CreateFieldTrial(field_trial_name, group_name); | 373 base::FieldTrialList::CreateFieldTrial(field_trial_name, group_name); |
372 // TODO(mef): Remove this check after the investigation of 359406 is complete. | 374 // TODO(mef): Remove this check after the investigation of 359406 is complete. |
373 CHECK(trial) << field_trial_name << ":" << group_name; | 375 CHECK(trial) << field_trial_name << ":" << group_name; |
374 // Ensure the trial is marked as "used" by calling group() on it. This is | 376 // Ensure the trial is marked as "used" by calling group() on it if it is |
375 // needed to ensure the trial is properly reported in renderer crash reports. | 377 // marked as activated. |
376 trial->group(); | 378 trial->group(); |
377 chrome_variations::SetChildProcessLoggingVariationList(); | 379 chrome_variations::SetChildProcessLoggingVariationList(); |
378 } | 380 } |
379 | 381 |
380 void ChromeRenderProcessObserver::OnGetV8HeapStats() { | 382 void ChromeRenderProcessObserver::OnGetV8HeapStats() { |
381 HeapStatisticsCollector::Instance()->InitiateCollection(); | 383 HeapStatisticsCollector::Instance()->InitiateCollection(); |
382 } | 384 } |
383 | 385 |
384 const RendererContentSettingRules* | 386 const RendererContentSettingRules* |
385 ChromeRenderProcessObserver::content_setting_rules() const { | 387 ChromeRenderProcessObserver::content_setting_rules() const { |
386 return &content_setting_rules_; | 388 return &content_setting_rules_; |
387 } | 389 } |
| 390 |
| 391 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized( |
| 392 const std::string& trial_name, |
| 393 const std::string& group_name) { |
| 394 content::RenderThread::Get()->Send( |
| 395 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); |
| 396 } |
OLD | NEW |