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 CONTENT_CHILD_CHILD_THREAD_IMPL_H_ | 5 #ifndef CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
6 #define CONTENT_CHILD_CHILD_THREAD_IMPL_H_ | 6 #define CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 class ThreadSafeSender; | 55 class ThreadSafeSender; |
56 class WebSocketDispatcher; | 56 class WebSocketDispatcher; |
57 struct RequestInfo; | 57 struct RequestInfo; |
58 | 58 |
59 // The main thread of a child process derives from this class. | 59 // The main thread of a child process derives from this class. |
60 class CONTENT_EXPORT ChildThreadImpl | 60 class CONTENT_EXPORT ChildThreadImpl |
61 : public IPC::Listener, | 61 : public IPC::Listener, |
62 virtual public ChildThread { | 62 virtual public ChildThread { |
63 public: | 63 public: |
64 struct CONTENT_EXPORT Options { | 64 struct CONTENT_EXPORT Options { |
65 Options(); | 65 Options(); |
rmcilroy
2015/03/03 19:48:17
Could you make the constructor private and only ca
Sami
2015/03/04 11:37:15
Yep, done.
| |
66 explicit Options(bool mojo); | |
67 Options(std::string name, bool mojo); | |
68 ~Options(); | 66 ~Options(); |
69 | 67 |
68 class Builder; | |
69 | |
70 std::string channel_name; | 70 std::string channel_name; |
71 bool use_mojo_channel; | 71 bool use_mojo_channel; |
72 bool in_browser_process; | 72 bool in_browser_process; |
73 std::vector<IPC::MessageFilter*> startup_filters; | 73 std::vector<IPC::MessageFilter*> startup_filters; |
74 }; | 74 }; |
75 | 75 |
76 // Creates the thread. | 76 // Creates the thread. |
77 ChildThreadImpl(); | 77 ChildThreadImpl(); |
78 // Allow to be used for single-process mode and for in process gpu mode via | 78 // Allow to be used for single-process mode and for in process gpu mode via |
79 // options. | 79 // options. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 | 298 |
299 scoped_refptr<NavigatorConnectDispatcher> navigator_connect_dispatcher_; | 299 scoped_refptr<NavigatorConnectDispatcher> navigator_connect_dispatcher_; |
300 | 300 |
301 bool in_browser_process_; | 301 bool in_browser_process_; |
302 | 302 |
303 base::WeakPtrFactory<ChildThreadImpl> channel_connected_factory_; | 303 base::WeakPtrFactory<ChildThreadImpl> channel_connected_factory_; |
304 | 304 |
305 DISALLOW_COPY_AND_ASSIGN(ChildThreadImpl); | 305 DISALLOW_COPY_AND_ASSIGN(ChildThreadImpl); |
306 }; | 306 }; |
307 | 307 |
308 class ChildThreadImpl::Options::Builder { | |
309 public: | |
310 Builder(); | |
311 | |
312 Builder& InBrowserProcess(bool in_browser_process); | |
313 Builder& WithMojo(bool mojo); | |
rmcilroy
2015/03/03 19:48:17
nit - UseMojoChannel(bool use_mojo_channel)
Sami
2015/03/04 11:37:15
Done.
| |
314 Builder& WithChannelName(const std::string& channel_name); | |
315 | |
316 Options Build(); | |
317 | |
318 private: | |
319 struct Options options_; | |
rmcilroy
2015/03/03 19:48:16
nit - I think this might be clearer inlined in the
Sami
2015/03/04 11:37:15
Did you mean the Options object itself would have
rmcilroy
2015/03/04 12:22:01
No that's not what I meant - I prefer the builder
| |
320 }; | |
321 | |
308 } // namespace content | 322 } // namespace content |
309 | 323 |
310 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ | 324 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
OLD | NEW |