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

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

Issue 17741010: Make ChildThread::current() and ChildProcess::current() only work on the main thread of the child... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and also fix gpu single process case Created 7 years, 5 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
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_CHILD_CHILD_THREAD_H_ 5 #ifndef CONTENT_CHILD_CHILD_THREAD_H_
6 #define CONTENT_CHILD_CHILD_THREAD_H_ 6 #define CONTENT_CHILD_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"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 FileSystemDispatcher* file_system_dispatcher() const { 88 FileSystemDispatcher* file_system_dispatcher() const {
89 return file_system_dispatcher_.get(); 89 return file_system_dispatcher_.get();
90 } 90 }
91 91
92 QuotaDispatcher* quota_dispatcher() const { 92 QuotaDispatcher* quota_dispatcher() const {
93 return quota_dispatcher_.get(); 93 return quota_dispatcher_.get();
94 } 94 }
95 95
96 // Safe to call on any thread, as long as it's guaranteed that the thread's
97 // lifetime is less than the main thread. The |filter| returned may only
98 // be used on background threads.
99 IPC::SyncMessageFilter* sync_message_filter() const { 96 IPC::SyncMessageFilter* sync_message_filter() const {
100 return sync_message_filter_.get(); 97 return sync_message_filter_.get();
101 } 98 }
102 99
103 // The getter should only be called on the main thread, however the 100 // The getter should only be called on the main thread, however the
104 // IPC::Sender it returns may be safely called on any thread including 101 // IPC::Sender it returns may be safely called on any thread including
105 // the main thread. 102 // the main thread.
106 ThreadSafeSender* thread_safe_sender() const { 103 ThreadSafeSender* thread_safe_sender() const {
107 return thread_safe_sender_.get(); 104 return thread_safe_sender_.get();
108 } 105 }
109 106
110 ChildHistogramMessageFilter* child_histogram_message_filter() const { 107 ChildHistogramMessageFilter* child_histogram_message_filter() const {
111 return histogram_message_filter_.get(); 108 return histogram_message_filter_.get();
112 } 109 }
113 110
114 base::MessageLoop* message_loop() const { return message_loop_; } 111 base::MessageLoop* message_loop() const { return message_loop_; }
115 112
116 // Returns the one child thread. 113 // Returns the one child thread. Can only be called on the main thread.
117 static ChildThread* current(); 114 static ChildThread* current();
118 115
119 virtual bool IsWebFrameValid(WebKit::WebFrame* frame); 116 #if defined(OS_ANDROID)
117 // Called on Android's service thread to shutdown the main thread of this
118 // process.
119 static void ShutdownThread();
120 #endif
120 121
121 protected: 122 protected:
122 friend class ChildProcess; 123 friend class ChildProcess;
123 124
124 // Called when the process refcount is 0. 125 // Called when the process refcount is 0.
125 void OnProcessFinalRelease(); 126 void OnProcessFinalRelease();
126 127
127 virtual bool OnControlMessageReceived(const IPC::Message& msg); 128 virtual bool OnControlMessageReceived(const IPC::Message& msg);
128 129
129 void set_on_channel_error_called(bool on_channel_error_called) { 130 void set_on_channel_error_called(bool on_channel_error_called) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 scoped_refptr<ChildResourceMessageFilter> resource_message_filter_; 185 scoped_refptr<ChildResourceMessageFilter> resource_message_filter_;
185 186
186 base::WeakPtrFactory<ChildThread> channel_connected_factory_; 187 base::WeakPtrFactory<ChildThread> channel_connected_factory_;
187 188
188 DISALLOW_COPY_AND_ASSIGN(ChildThread); 189 DISALLOW_COPY_AND_ASSIGN(ChildThread);
189 }; 190 };
190 191
191 } // namespace content 192 } // namespace content
192 193
193 #endif // CONTENT_CHILD_CHILD_THREAD_H_ 194 #endif // CONTENT_CHILD_CHILD_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698