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

Side by Side Diff: ceee/ie/broker/broker_rpc_server.cc

Issue 6336010: Add missing base::lock usage. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ceee/ie/plugin/bho/window_message_source.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Broker RPC Server implementation. 5 // Broker RPC Server implementation.
6 6
7 #include "ceee/ie/broker/broker_rpc_server.h" 7 #include "ceee/ie/broker/broker_rpc_server.h"
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/process_util.h" 12 #include "base/process_util.h"
13 #include "broker_rpc_lib.h" // NOLINT 13 #include "broker_rpc_lib.h" // NOLINT
14 #include "ceee/common/com_utils.h" 14 #include "ceee/common/com_utils.h"
15 #include "ceee/ie/broker/broker_module_util.h" 15 #include "ceee/ie/broker/broker_module_util.h"
16 #include "ceee/ie/broker/broker_rpc_utils.h" 16 #include "ceee/ie/broker/broker_rpc_utils.h"
17 #include "ceee/ie/broker/chrome_postman.h" 17 #include "ceee/ie/broker/chrome_postman.h"
18 18
19 19
20 namespace { 20 namespace {
21 // This lock ensures that histograms created by the broker are thread safe. 21 // This lock ensures that histograms created by the broker are thread safe.
22 // The histograms created here can be initialized on multiple threads. 22 // The histograms created here can be initialized on multiple threads.
23 Lock g_metrics_lock; 23 base::Lock g_metrics_lock;
24 24
25 RPC_STATUS PrepareEndpoint(std::wstring endpoint) { 25 RPC_STATUS PrepareEndpoint(std::wstring endpoint) {
26 std::wstring protocol = kRpcProtocol; 26 std::wstring protocol = kRpcProtocol;
27 DCHECK(!protocol.empty()); 27 DCHECK(!protocol.empty());
28 DCHECK(!endpoint.empty()); 28 DCHECK(!endpoint.empty());
29 if (protocol.empty() || endpoint.empty()) 29 if (protocol.empty() || endpoint.empty())
30 return false; 30 return false;
31 VLOG(1) << "RPC server is starting. Endpoint: " << endpoint; 31 VLOG(1) << "RPC server is starting. Endpoint: " << endpoint;
32 // Tell RPC runtime to use local interprocess communication for given 32 // Tell RPC runtime to use local interprocess communication for given
33 // end point. 33 // end point.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // We can't unfortunately use the HISTOGRAM_*_COUNT here because they use 176 // We can't unfortunately use the HISTOGRAM_*_COUNT here because they use
177 // static variables to save time. 177 // static variables to save time.
178 base::AutoLock lock(g_metrics_lock); 178 base::AutoLock lock(g_metrics_lock);
179 scoped_refptr<base::Histogram> counter = 179 scoped_refptr<base::Histogram> counter =
180 base::Histogram::FactoryGet(name, min, max, bucket_count, 180 base::Histogram::FactoryGet(name, min, max, bucket_count,
181 base::Histogram::kUmaTargetedHistogramFlag); 181 base::Histogram::kUmaTargetedHistogramFlag);
182 DCHECK_EQ(name, counter->histogram_name()); 182 DCHECK_EQ(name, counter->histogram_name());
183 if (counter.get()) 183 if (counter.get())
184 counter->AddTime(base::TimeDelta::FromMilliseconds(sample)); 184 counter->AddTime(base::TimeDelta::FromMilliseconds(sample));
185 } 185 }
OLDNEW
« no previous file with comments | « no previous file | ceee/ie/plugin/bho/window_message_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698