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

Side by Side Diff: chrome/browser/service_process/service_process_control.cc

Issue 510563004: Temporary allocation of 20Mb before and after call to ServiceProcessControl::GetHistograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wed Aug 27 17:26:56 PDT 2014 Created 6 years, 3 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 | « no previous file | no next file » | 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/service_process/service_process_control.h" 5 #include "chrome/browser/service_process/service_process_control.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/metrics/histogram_base.h" 11 #include "base/metrics/histogram_base.h"
12 #include "base/metrics/histogram_delta_serialization.h" 12 #include "base/metrics/histogram_delta_serialization.h"
13 #include "base/process/kill.h" 13 #include "base/process/kill.h"
14 #include "base/process/launch.h" 14 #include "base/process/launch.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "base/threading/thread_restrictions.h" 17 #include "base/threading/thread_restrictions.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/upgrade_detector.h" 20 #include "chrome/browser/upgrade_detector.h"
21 #include "chrome/common/service_messages.h" 21 #include "chrome/common/service_messages.h"
22 #include "chrome/common/service_process_util.h" 22 #include "chrome/common/service_process_util.h"
23 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
25 25
26 using content::BrowserThread; 26 using content::BrowserThread;
27 27
28 namespace {
29
30 void AllocDebugTest() {
31 // TODO(vitalybuka): Remove after few Canary builds.
32 // See http://crbug.com/406227
33 void* buffer = malloc(20 * 1024 * 1024);
tapted 2014/08/28 01:07:27 nit: Maybe guard these lines in #if defined(OS_MAC
Vitaly Buka (NO REVIEWS) 2014/08/28 03:24:51 Done.
34 CHECK(buffer);
35 free(buffer);
36 }
37
38 } // namespace
39
28 // ServiceProcessControl implementation. 40 // ServiceProcessControl implementation.
29 ServiceProcessControl::ServiceProcessControl() { 41 ServiceProcessControl::ServiceProcessControl() {
30 } 42 }
31 43
32 ServiceProcessControl::~ServiceProcessControl() { 44 ServiceProcessControl::~ServiceProcessControl() {
33 } 45 }
34 46
35 void ServiceProcessControl::ConnectInternal() { 47 void ServiceProcessControl::ConnectInternal() {
36 // If the channel has already been established then we run the task 48 // If the channel has already been established then we run the task
37 // and return. 49 // and return.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 const std::vector<std::string>& pickled_histograms) { 228 const std::vector<std::string>& pickled_histograms) {
217 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceEvents", 229 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceEvents",
218 SERVICE_EVENT_HISTOGRAMS_REPLY, SERVICE_EVENT_MAX); 230 SERVICE_EVENT_HISTOGRAMS_REPLY, SERVICE_EVENT_MAX);
219 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 231 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
220 base::HistogramDeltaSerialization::DeserializeAndAddSamples( 232 base::HistogramDeltaSerialization::DeserializeAndAddSamples(
221 pickled_histograms); 233 pickled_histograms);
222 RunHistogramsCallback(); 234 RunHistogramsCallback();
223 } 235 }
224 236
225 void ServiceProcessControl::RunHistogramsCallback() { 237 void ServiceProcessControl::RunHistogramsCallback() {
238 AllocDebugTest();
226 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
227 if (!histograms_callback_.is_null()) { 240 if (!histograms_callback_.is_null()) {
228 histograms_callback_.Run(); 241 histograms_callback_.Run();
229 histograms_callback_.Reset(); 242 histograms_callback_.Reset();
230 } 243 }
231 histograms_timeout_callback_.Cancel(); 244 histograms_timeout_callback_.Cancel();
232 } 245 }
233 246
234 void ServiceProcessControl::OnPrinters( 247 void ServiceProcessControl::OnPrinters(
235 const std::vector<std::string>& printers) { 248 const std::vector<std::string>& printers) {
(...skipping 16 matching lines...) Expand all
252 SERVICE_EVENT_INFO_REQUEST, SERVICE_EVENT_MAX); 265 SERVICE_EVENT_INFO_REQUEST, SERVICE_EVENT_MAX);
253 if (!Send(new ServiceMsg_GetCloudPrintProxyInfo())) 266 if (!Send(new ServiceMsg_GetCloudPrintProxyInfo()))
254 return false; 267 return false;
255 cloud_print_info_callback_ = cloud_print_info_callback; 268 cloud_print_info_callback_ = cloud_print_info_callback;
256 return true; 269 return true;
257 } 270 }
258 271
259 bool ServiceProcessControl::GetHistograms( 272 bool ServiceProcessControl::GetHistograms(
260 const base::Closure& histograms_callback, 273 const base::Closure& histograms_callback,
261 const base::TimeDelta& timeout) { 274 const base::TimeDelta& timeout) {
275 AllocDebugTest();
262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
263 DCHECK(!histograms_callback.is_null()); 277 DCHECK(!histograms_callback.is_null());
264 histograms_callback_.Reset(); 278 histograms_callback_.Reset();
265 279
266 // If the service process is already running then connect to it. 280 // If the service process is already running then connect to it.
267 if (!CheckServiceProcessReady()) 281 if (!CheckServiceProcessReady())
268 return false; 282 return false;
269 ConnectInternal(); 283 ConnectInternal();
270 284
271 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceEvents", 285 UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceEvents",
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 if (base::LaunchProcess(*cmd_line_, options, &process_handle_)) { 399 if (base::LaunchProcess(*cmd_line_, options, &process_handle_)) {
386 BrowserThread::PostTask( 400 BrowserThread::PostTask(
387 BrowserThread::IO, FROM_HERE, 401 BrowserThread::IO, FROM_HERE,
388 base::Bind(&Launcher::DoDetectLaunched, this)); 402 base::Bind(&Launcher::DoDetectLaunched, this));
389 } else { 403 } else {
390 BrowserThread::PostTask( 404 BrowserThread::PostTask(
391 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); 405 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this));
392 } 406 }
393 } 407 }
394 #endif // !OS_MACOSX 408 #endif // !OS_MACOSX
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698