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

Unified Diff: chrome/service/service_process.cc

Issue 2001009: Created a new process type called the service process to host background task... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/service/service_process.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/service_process.cc
===================================================================
--- chrome/service/service_process.cc (revision 0)
+++ chrome/service/service_process.cc (revision 0)
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/service/service_process.h"
+
+#include "chrome/service/cloud_print/cloud_print_proxy.h"
+
+ServiceProcess* g_service_process = NULL;
+
+ServiceProcess::ServiceProcess() {
+ DCHECK(!g_service_process);
+ g_service_process = this;
+}
+
+bool ServiceProcess::Initialize() {
+ base::Thread::Options options;
+ options.message_loop_type = MessageLoop::TYPE_IO;
+ io_thread_.reset(new base::Thread("ServiceProcess_IO"));
+ file_thread_.reset(new base::Thread("ServiceProcess_File"));
+ if (!io_thread_->StartWithOptions(options) ||
+ !file_thread_->StartWithOptions(options)) {
+ NOTREACHED();
+ Teardown();
+ return false;
+ }
+ return true;
+}
+
+bool ServiceProcess::Teardown() {
+ io_thread_.reset();
+ file_thread_.reset();
+ return true;
+}
+
+CloudPrintProxy* ServiceProcess::cloud_print_proxy() {
+ if (!cloud_print_proxy_.get()) {
+ cloud_print_proxy_.reset(new CloudPrintProxy());
+ cloud_print_proxy_->Initialize();
+ }
+ return cloud_print_proxy_.get();
+}
+
+ServiceProcess::~ServiceProcess() {
+ Teardown();
+ g_service_process = NULL;
+}
+
Property changes on: chrome\service\service_process.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/service/service_process.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698