OLD | NEW |
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 #ifndef CHROME_SERVICE_SERVICE_PROCESS_H_ | 5 #ifndef CHROME_SERVICE_SERVICE_PROCESS_H_ |
6 #define CHROME_SERVICE_SERVICE_PROCESS_H_ | 6 #define CHROME_SERVICE_SERVICE_PROCESS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 // Initialize the ServiceProcess with the message loop that it should run on. | 40 // Initialize the ServiceProcess with the message loop that it should run on. |
41 // ServiceProcess takes ownership of |state|. | 41 // ServiceProcess takes ownership of |state|. |
42 bool Initialize(base::MessageLoopForUI* message_loop, | 42 bool Initialize(base::MessageLoopForUI* message_loop, |
43 const base::CommandLine& command_line, | 43 const base::CommandLine& command_line, |
44 ServiceProcessState* state); | 44 ServiceProcessState* state); |
45 | 45 |
46 bool Teardown(); | 46 bool Teardown(); |
47 // TODO(sanjeevr): Change various parts of the code such as | 47 // TODO(sanjeevr): Change various parts of the code such as |
48 // net::ProxyService::CreateSystemProxyConfigService to take in | 48 // net::ProxyService::CreateSystemProxyConfigService to take in |
49 // MessageLoopProxy* instead of MessageLoop*. When we have done that, we can | 49 // SingleThreadTaskRunner* instead of MessageLoop*. When we have done that, |
50 // remove the io_thread() and file_thread() accessors and replace them with | 50 // we can remove the io_thread() and file_thread() accessors and replace them |
51 // io_message_loop_proxy() and file_message_loop_proxy() respectively. | 51 // with io_message_loop_proxy() and file_message_loop_proxy() respectively. |
52 | 52 |
53 // Returns the thread that we perform I/O coordination on (network requests, | 53 // Returns the thread that we perform I/O coordination on (network requests, |
54 // communication with renderers, etc. | 54 // communication with renderers, etc. |
55 // NOTE: You should ONLY use this to pass to IPC or other objects which must | 55 // NOTE: You should ONLY use this to pass to IPC or other objects which must |
56 // need a MessageLoop*. If you just want to post a task, use the thread's | 56 // need a MessageLoop*. If you just want to post a task, use the thread's |
57 // message_loop_proxy() as it takes care of checking that a thread is still | 57 // task_runner() as it takes care of checking that a thread is still alive, |
58 // alive, race conditions, lifetime differences etc. | 58 // race conditions, lifetime differences etc. If you still must use this, |
59 // If you still must use this, need to check the return value for NULL. | 59 // need to check the return value for NULL. |
60 base::Thread* io_thread() const { | 60 base::Thread* io_thread() const { |
61 return io_thread_.get(); | 61 return io_thread_.get(); |
62 } | 62 } |
63 // Returns the thread that we perform random file operations on. For code | 63 // Returns the thread that we perform random file operations on. For code |
64 // that wants to do I/O operations (not network requests or even file: URL | 64 // that wants to do I/O operations (not network requests or even file: URL |
65 // requests), this is the thread to use to avoid blocking the UI thread. | 65 // requests), this is the thread to use to avoid blocking the UI thread. |
66 base::Thread* file_thread() const { | 66 base::Thread* file_thread() const { |
67 return file_thread_.get(); | 67 return file_thread_.get(); |
68 } | 68 } |
69 | 69 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 bool update_available_; | 138 bool update_available_; |
139 | 139 |
140 scoped_refptr<ServiceURLRequestContextGetter> request_context_getter_; | 140 scoped_refptr<ServiceURLRequestContextGetter> request_context_getter_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(ServiceProcess); | 142 DISALLOW_COPY_AND_ASSIGN(ServiceProcess); |
143 }; | 143 }; |
144 | 144 |
145 extern ServiceProcess* g_service_process; | 145 extern ServiceProcess* g_service_process; |
146 | 146 |
147 #endif // CHROME_SERVICE_SERVICE_PROCESS_H_ | 147 #endif // CHROME_SERVICE_SERVICE_PROCESS_H_ |
OLD | NEW |