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

Side by Side Diff: chrome/browser/metrics/field_trial_synchronizer.cc

Issue 2024683002: Remove debug instrumentation for crbug.com/359406. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update render_messages macro 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
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/common/render_messages.h » ('j') | 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) 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/browser/metrics/field_trial_synchronizer.h" 5 #include "chrome/browser/metrics/field_trial_synchronizer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "chrome/common/chrome_constants.h"
11 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
12 #include "components/variations/variations_util.h" 11 #include "components/variations/variations_util.h"
13 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
15 14
16 using content::BrowserThread; 15 using content::BrowserThread;
17 16
18 namespace { 17 namespace {
19 18
20 // This singleton instance should be constructed during the single threaded 19 // This singleton instance should be constructed during the single threaded
(...skipping 12 matching lines...) Expand all
33 variations::SetVariationListCrashKeys(); 32 variations::SetVariationListCrashKeys();
34 } 33 }
35 34
36 void FieldTrialSynchronizer::NotifyAllRenderers( 35 void FieldTrialSynchronizer::NotifyAllRenderers(
37 const std::string& field_trial_name, 36 const std::string& field_trial_name,
38 const std::string& group_name) { 37 const std::string& group_name) {
39 // To iterate over RenderProcessHosts, or to send messages to the hosts, we 38 // To iterate over RenderProcessHosts, or to send messages to the hosts, we
40 // need to be on the UI thread. 39 // need to be on the UI thread.
41 DCHECK_CURRENTLY_ON(BrowserThread::UI); 40 DCHECK_CURRENTLY_ON(BrowserThread::UI);
42 41
43 // Check that the sender's PID doesn't change between messages. We expect
44 // these IPCs to always be delivered from the same browser process, whose pid
45 // should not change.
46 // TODO(asvitkine): Remove this after http://crbug.com/359406 is fixed.
47 static base::ProcessId sender_pid = base::Process::Current().Pid();
48 for (content::RenderProcessHost::iterator it( 42 for (content::RenderProcessHost::iterator it(
49 content::RenderProcessHost::AllHostsIterator()); 43 content::RenderProcessHost::AllHostsIterator());
50 !it.IsAtEnd(); it.Advance()) { 44 !it.IsAtEnd(); it.Advance()) {
51 it.GetCurrentValue()->Send(new ChromeViewMsg_SetFieldTrialGroup( 45 it.GetCurrentValue()->Send(new ChromeViewMsg_SetFieldTrialGroup(
52 field_trial_name, group_name, sender_pid, 46 field_trial_name, group_name));
53 base::FieldTrialList::GetDebugToken()));
54 } 47 }
55 } 48 }
56 49
57 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized( 50 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized(
58 const std::string& field_trial_name, 51 const std::string& field_trial_name,
59 const std::string& group_name) { 52 const std::string& group_name) {
60 // TODO(asvitkine): Remove these CHECKs once http://crbug.com/359406 is fixed.
61 CHECK(!field_trial_name.empty() && !group_name.empty());
62 CHECK_EQ(group_name, base::FieldTrialList::FindFullName(field_trial_name))
63 << field_trial_name << ":" << group_name << "=>"
64 << base::FieldTrialList::FindFullName(field_trial_name);
65 BrowserThread::PostTask( 53 BrowserThread::PostTask(
66 BrowserThread::UI, FROM_HERE, 54 BrowserThread::UI, FROM_HERE,
67 base::Bind(&FieldTrialSynchronizer::NotifyAllRenderers, 55 base::Bind(&FieldTrialSynchronizer::NotifyAllRenderers,
68 this, 56 this,
69 field_trial_name, 57 field_trial_name,
70 group_name)); 58 group_name));
71 variations::SetVariationListCrashKeys(); 59 variations::SetVariationListCrashKeys();
72 } 60 }
73 61
74 FieldTrialSynchronizer::~FieldTrialSynchronizer() { 62 FieldTrialSynchronizer::~FieldTrialSynchronizer() {
75 base::FieldTrialList::RemoveObserver(this); 63 base::FieldTrialList::RemoveObserver(this);
76 g_field_trial_synchronizer = NULL; 64 g_field_trial_synchronizer = NULL;
77 } 65 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698