| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_SERVICE_SERVICE_PROCESS_H_ |
| 6 #define CHROME_SERVICE_SERVICE_PROCESS_H_ |
| 7 |
| 8 |
| 9 #include "base/thread.h" |
| 10 |
| 11 class CloudPrintProxy; |
| 12 |
| 13 // The ServiceProcess does not inherit from ChildProcess because this |
| 14 // process can live independently of the browser process. |
| 15 class ServiceProcess { |
| 16 public: |
| 17 ServiceProcess(); |
| 18 ~ServiceProcess(); |
| 19 |
| 20 bool Initialize(); |
| 21 bool Teardown(); |
| 22 // TODO(sanjeevr): Change various parts of the code such as |
| 23 // net::ProxyService::CreateSystemProxyConfigService to take in |
| 24 // MessageLoopProxy* instead of MessageLoop*. When we have done that, we can |
| 25 // remove the io_thread() and file_thread() accessors and replace them with |
| 26 // io_message_loop_proxy() and file_message_loop_proxy() respectively. |
| 27 |
| 28 // Returns the thread that we perform I/O coordination on (network requests, |
| 29 // communication with renderers, etc. |
| 30 // NOTE: You should ONLY use this to pass to IPC or other objects which must |
| 31 // need a MessageLoop*. If you just want to post a task, use the thread's |
| 32 // message_loop_proxy() as it takes care of checking that a thread is still |
| 33 // alive, race conditions, lifetime differences etc. |
| 34 // If you still must use this, need to check the return value for NULL. |
| 35 base::Thread* io_thread() const { |
| 36 return io_thread_.get(); |
| 37 } |
| 38 // Returns the thread that we perform random file operations on. For code |
| 39 // that wants to do I/O operations (not network requests or even file: URL |
| 40 // requests), this is the thread to use to avoid blocking the UI thread. |
| 41 base::Thread* file_thread() const { |
| 42 return file_thread_.get(); |
| 43 } |
| 44 CloudPrintProxy* cloud_print_proxy(); |
| 45 |
| 46 private: |
| 47 scoped_ptr<base::Thread> io_thread_; |
| 48 scoped_ptr<base::Thread> file_thread_; |
| 49 scoped_ptr<CloudPrintProxy> cloud_print_proxy_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(ServiceProcess); |
| 52 }; |
| 53 |
| 54 extern ServiceProcess* g_service_process; |
| 55 |
| 56 #endif // CHROME_SERVICE_SERVICE_PROCESS_H_ |
| 57 |
| OLD | NEW |