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

Side by Side Diff: chrome/service/service_process.cc

Issue 9187023: Convert use of int ms to TimeDelta in files owned by ajwong. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove static class instance initialization. Created 8 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
« no previous file with comments | « chrome/service/cloud_print/print_system_cups.cc ('k') | jingle/glue/thread_wrapper.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) 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/service/service_process.h" 5 #include "chrome/service/service_process.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 25 matching lines...) Expand all
36 36
37 #if defined(TOOLKIT_USES_GTK) 37 #if defined(TOOLKIT_USES_GTK)
38 #include "ui/gfx/gtk_util.h" 38 #include "ui/gfx/gtk_util.h"
39 #include <gtk/gtk.h> 39 #include <gtk/gtk.h>
40 #endif 40 #endif
41 41
42 ServiceProcess* g_service_process = NULL; 42 ServiceProcess* g_service_process = NULL;
43 43
44 namespace { 44 namespace {
45 45
46 // Delay in millseconds after the last service is disabled before we attempt 46 // Delay in seconds after the last service is disabled before we attempt
47 // a shutdown. 47 // a shutdown.
48 const int64 kShutdownDelay = 60000; 48 const int kShutdownDelaySeconds = 60;
49 49
50 // Delay in milliseconds between launching a browser process to check the 50 // Delay in milliseconds between launching a browser process to check the
51 // policy for us. 8 hours * 60 * 60 * 1000 51 // policy for us. 8 hours * 60 * 60 * 1000
52 const int64 kPolicyCheckDelay = 28800000; 52 const int64 kPolicyCheckDelay = 28800000;
53 53
54 const char kDefaultServiceProcessLocale[] = "en-US"; 54 const char kDefaultServiceProcessLocale[] = "en-US";
55 55
56 class ServiceIOThread : public base::Thread { 56 class ServiceIOThread : public base::Thread {
57 public: 57 public:
58 explicit ServiceIOThread(const char* name); 58 explicit ServiceIOThread(const char* name);
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 349 }
350 // We will wait for some time to respond to IPCs before shutting down. 350 // We will wait for some time to respond to IPCs before shutting down.
351 ScheduleShutdownCheck(); 351 ScheduleShutdownCheck();
352 } 352 }
353 } 353 }
354 354
355 void ServiceProcess::ScheduleShutdownCheck() { 355 void ServiceProcess::ScheduleShutdownCheck() {
356 MessageLoop::current()->PostDelayedTask( 356 MessageLoop::current()->PostDelayedTask(
357 FROM_HERE, 357 FROM_HERE,
358 base::Bind(&ServiceProcess::ShutdownIfNeeded, base::Unretained(this)), 358 base::Bind(&ServiceProcess::ShutdownIfNeeded, base::Unretained(this)),
359 kShutdownDelay); 359 base::TimeDelta::FromSeconds(kShutdownDelaySeconds));
360 } 360 }
361 361
362 void ServiceProcess::ShutdownIfNeeded() { 362 void ServiceProcess::ShutdownIfNeeded() {
363 if (0 == enabled_services_) { 363 if (0 == enabled_services_) {
364 if (ipc_server_->is_client_connected()) { 364 if (ipc_server_->is_client_connected()) {
365 // If there is a client connected, we need to try again later. 365 // If there is a client connected, we need to try again later.
366 // Note that there is still a timing window here because a client may 366 // Note that there is still a timing window here because a client may
367 // decide to connect at this point. 367 // decide to connect at this point.
368 // TODO(sanjeevr): Fix this timing window. 368 // TODO(sanjeevr): Fix this timing window.
369 ScheduleShutdownCheck(); 369 ScheduleShutdownCheck();
(...skipping 15 matching lines...) Expand all
385 if (enabled_services_ && !ipc_server_->is_client_connected()) { 385 if (enabled_services_ && !ipc_server_->is_client_connected()) {
386 GetCloudPrintProxy()->CheckCloudPrintProxyPolicy(); 386 GetCloudPrintProxy()->CheckCloudPrintProxyPolicy();
387 } 387 }
388 ScheduleCloudPrintPolicyCheck(); 388 ScheduleCloudPrintPolicyCheck();
389 } 389 }
390 390
391 ServiceProcess::~ServiceProcess() { 391 ServiceProcess::~ServiceProcess() {
392 Teardown(); 392 Teardown();
393 g_service_process = NULL; 393 g_service_process = NULL;
394 } 394 }
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/print_system_cups.cc ('k') | jingle/glue/thread_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698