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

Side by Side Diff: content/common/child_thread.h

Issue 11227033: Move a bunch of code in content\common (as well as a few left in renderer) to the content namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « content/common/child_process.cc ('k') | content/common/child_thread.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 #ifndef CONTENT_COMMON_CHILD_THREAD_H_ 5 #ifndef CONTENT_COMMON_CHILD_THREAD_H_
6 #define CONTENT_COMMON_CHILD_THREAD_H_ 6 #define CONTENT_COMMON_CHILD_THREAD_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/shared_memory.h" 11 #include "base/shared_memory.h"
12 #include "base/tracked_objects.h" 12 #include "base/tracked_objects.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/common/message_router.h" 14 #include "content/common/message_router.h"
15 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. 15 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
16 #include "webkit/glue/resource_loader_bridge.h" 16 #include "webkit/glue/resource_loader_bridge.h"
17 17
18 class FileSystemDispatcher;
19 class MessageLoop; 18 class MessageLoop;
20 class QuotaDispatcher;
21 class SocketStreamDispatcher;
22
23 namespace content {
24 class ChildHistogramMessageFilter;
25 class ResourceDispatcher;
26 }
27 19
28 namespace IPC { 20 namespace IPC {
29 class SyncChannel; 21 class SyncChannel;
30 class SyncMessageFilter; 22 class SyncMessageFilter;
31 } 23 }
32 24
33 namespace WebKit { 25 namespace WebKit {
34 class WebFrame; 26 class WebFrame;
35 } 27 }
36 28
29 namespace content {
30 class ChildHistogramMessageFilter;
31 class FileSystemDispatcher;
32 class QuotaDispatcher;
33 class ResourceDispatcher;
34 class SocketStreamDispatcher;
35
37 // The main thread of a child process derives from this class. 36 // The main thread of a child process derives from this class.
38 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { 37 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender {
39 public: 38 public:
40 // Creates the thread. 39 // Creates the thread.
41 ChildThread(); 40 ChildThread();
42 // Used for single-process mode. 41 // Used for single-process mode.
43 explicit ChildThread(const std::string& channel_name); 42 explicit ChildThread(const std::string& channel_name);
44 virtual ~ChildThread(); 43 virtual ~ChildThread();
45 44
46 // IPC::Sender implementation: 45 // IPC::Sender implementation:
(...skipping 11 matching lines...) Expand all
58 // Tests can override this method if they want a custom loading behavior. 57 // Tests can override this method if they want a custom loading behavior.
59 virtual webkit_glue::ResourceLoaderBridge* CreateBridge( 58 virtual webkit_glue::ResourceLoaderBridge* CreateBridge(
60 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); 59 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info);
61 60
62 // Allocates a block of shared memory of the given size and 61 // Allocates a block of shared memory of the given size and
63 // maps in into the address space. Returns NULL of failure. 62 // maps in into the address space. Returns NULL of failure.
64 // Note: On posix, this requires a sync IPC to the browser process, 63 // Note: On posix, this requires a sync IPC to the browser process,
65 // but on windows the child process directly allocates the block. 64 // but on windows the child process directly allocates the block.
66 base::SharedMemory* AllocateSharedMemory(size_t buf_size); 65 base::SharedMemory* AllocateSharedMemory(size_t buf_size);
67 66
68 content::ResourceDispatcher* resource_dispatcher(); 67 ResourceDispatcher* resource_dispatcher();
69 68
70 SocketStreamDispatcher* socket_stream_dispatcher() { 69 SocketStreamDispatcher* socket_stream_dispatcher() {
71 return socket_stream_dispatcher_.get(); 70 return socket_stream_dispatcher_.get();
72 } 71 }
73 72
74 FileSystemDispatcher* file_system_dispatcher() const { 73 FileSystemDispatcher* file_system_dispatcher() const {
75 return file_system_dispatcher_.get(); 74 return file_system_dispatcher_.get();
76 } 75 }
77 76
78 QuotaDispatcher* quota_dispatcher() const { 77 QuotaDispatcher* quota_dispatcher() const {
79 return quota_dispatcher_.get(); 78 return quota_dispatcher_.get();
80 } 79 }
81 80
82 // Safe to call on any thread, as long as it's guaranteed that the thread's 81 // Safe to call on any thread, as long as it's guaranteed that the thread's
83 // lifetime is less than the main thread. 82 // lifetime is less than the main thread.
84 IPC::SyncMessageFilter* sync_message_filter(); 83 IPC::SyncMessageFilter* sync_message_filter();
85 84
86 content::ChildHistogramMessageFilter* child_histogram_message_filter() const { 85 ChildHistogramMessageFilter* child_histogram_message_filter() const {
87 return histogram_message_filter_.get(); 86 return histogram_message_filter_.get();
88 } 87 }
89 88
90 MessageLoop* message_loop(); 89 MessageLoop* message_loop();
91 90
92 // Returns the one child thread. 91 // Returns the one child thread.
93 static ChildThread* current(); 92 static ChildThread* current();
94 93
95 virtual bool IsWebFrameValid(WebKit::WebFrame* frame); 94 virtual bool IsWebFrameValid(WebKit::WebFrame* frame);
96 95
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 std::string channel_name_; 130 std::string channel_name_;
132 scoped_ptr<IPC::SyncChannel> channel_; 131 scoped_ptr<IPC::SyncChannel> channel_;
133 132
134 // Allows threads other than the main thread to send sync messages. 133 // Allows threads other than the main thread to send sync messages.
135 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; 134 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_;
136 135
137 // Implements message routing functionality to the consumers of ChildThread. 136 // Implements message routing functionality to the consumers of ChildThread.
138 MessageRouter router_; 137 MessageRouter router_;
139 138
140 // Handles resource loads for this process. 139 // Handles resource loads for this process.
141 scoped_ptr<content::ResourceDispatcher> resource_dispatcher_; 140 scoped_ptr<ResourceDispatcher> resource_dispatcher_;
142 141
143 // Handles SocketStream for this process. 142 // Handles SocketStream for this process.
144 scoped_ptr<SocketStreamDispatcher> socket_stream_dispatcher_; 143 scoped_ptr<SocketStreamDispatcher> socket_stream_dispatcher_;
145 144
146 // The OnChannelError() callback was invoked - the channel is dead, don't 145 // The OnChannelError() callback was invoked - the channel is dead, don't
147 // attempt to communicate. 146 // attempt to communicate.
148 bool on_channel_error_called_; 147 bool on_channel_error_called_;
149 148
150 MessageLoop* message_loop_; 149 MessageLoop* message_loop_;
151 150
152 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_; 151 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_;
153 152
154 scoped_ptr<QuotaDispatcher> quota_dispatcher_; 153 scoped_ptr<QuotaDispatcher> quota_dispatcher_;
155 154
156 scoped_refptr<content::ChildHistogramMessageFilter> histogram_message_filter_; 155 scoped_refptr<ChildHistogramMessageFilter> histogram_message_filter_;
157 156
158 base::WeakPtrFactory<ChildThread> channel_connected_factory_; 157 base::WeakPtrFactory<ChildThread> channel_connected_factory_;
159 158
160 DISALLOW_COPY_AND_ASSIGN(ChildThread); 159 DISALLOW_COPY_AND_ASSIGN(ChildThread);
161 }; 160 };
162 161
162 } // namespace content
163
163 #endif // CONTENT_COMMON_CHILD_THREAD_H_ 164 #endif // CONTENT_COMMON_CHILD_THREAD_H_
OLDNEW
« no previous file with comments | « content/common/child_process.cc ('k') | content/common/child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698