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

Side by Side Diff: content/public/browser/browser_thread.h

Issue 8769013: Remove BrowserThread::UnsafeGetBrowserThread, add UnsafeGetMessageLoopForThread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to lkgr (pure merge). Created 9 years 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/browser/browser_thread_impl.cc ('k') | content/shell/shell_browser_context.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_PUBLIC_BROWSER_BROWSER_THREAD_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 // If the current message loop is one of the known threads, returns true and 171 // If the current message loop is one of the known threads, returns true and
172 // sets identifier to its ID. Otherwise returns false. 172 // sets identifier to its ID. Otherwise returns false.
173 static bool GetCurrentThreadIdentifier(ID* identifier); 173 static bool GetCurrentThreadIdentifier(ID* identifier);
174 174
175 // Callers can hold on to a refcounted MessageLoopProxy beyond the lifetime 175 // Callers can hold on to a refcounted MessageLoopProxy beyond the lifetime
176 // of the thread. 176 // of the thread.
177 static scoped_refptr<base::MessageLoopProxy> GetMessageLoopProxyForThread( 177 static scoped_refptr<base::MessageLoopProxy> GetMessageLoopProxyForThread(
178 ID identifier); 178 ID identifier);
179 179
180 // Gets the Thread object for the specified thread, or NULL if the 180 // Returns a pointer to the thread's message loop, which will become
181 // thread has not been created (or has been destroyed during 181 // invalid during shutdown, so you probably shouldn't hold onto it.
182 // shutdown).
183 // 182 //
184 // Before calling this, you must have called content::ContentMain 183 // This must not be called before the thread is started, or after
185 // with a command-line that would specify a browser process (e.g. an 184 // the thread is stopped, or it will DCHECK.
186 // empty command line).
187 // 185 //
188 // It is unsafe to store this pointer as it may become invalid close 186 // Ownership remains with the BrowserThread implementation, so you
189 // to shutdown. 187 // must not delete the pointer.
190 // 188 static MessageLoop* UnsafeGetMessageLoopForThread(ID identifier);
191 // TODO(joi): Remove this once clients such as BrowserProcessImpl
192 // (and classes that call things like
193 // g_browser_process->file_thread()) are switched to using
194 // MessageLoopProxy.
195 static base::Thread* UnsafeGetBrowserThread(ID identifier);
196
197 // Gets the MessageLoop for the specified thread, or NULL if the
198 // thread has not been created (or has been destroyed during
199 // shutdown).
200 //
201 // Before calling this, you must have called content::ContentMain
202 // with a command-line that would specify a browser process (e.g. an
203 // empty command line).
204 //
205 // It is unsafe to store this pointer as it may become invalid close
206 // to shutdown.
207 //
208 // TODO(joi): Remove this once clients such as BrowserProcessImpl
209 // (and classes that call things like
210 // g_browser_process->file_thread()) are switched to using
211 // MessageLoopProxy.
212 static MessageLoop* UnsafeGetMessageLoop(ID identifier);
213 189
214 // Sets the delegate for the specified BrowserThread. 190 // Sets the delegate for the specified BrowserThread.
215 // 191 //
216 // Only one delegate may be registered at a time. Delegates may be 192 // Only one delegate may be registered at a time. Delegates may be
217 // unregistered by providing a NULL pointer. 193 // unregistered by providing a NULL pointer.
218 // 194 //
219 // If the caller unregisters a delegate before CleanUp has been 195 // If the caller unregisters a delegate before CleanUp has been
220 // called, it must perform its own locking to ensure the delegate is 196 // called, it must perform its own locking to ensure the delegate is
221 // not deleted while unregistering. 197 // not deleted while unregistering.
222 static void SetDelegate(ID identifier, BrowserThreadDelegate* delegate); 198 static void SetDelegate(ID identifier, BrowserThreadDelegate* delegate);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 private: 242 private:
267 friend class BrowserThreadImpl; 243 friend class BrowserThreadImpl;
268 244
269 BrowserThread() {} 245 BrowserThread() {}
270 DISALLOW_COPY_AND_ASSIGN(BrowserThread); 246 DISALLOW_COPY_AND_ASSIGN(BrowserThread);
271 }; 247 };
272 248
273 } // namespace content 249 } // namespace content
274 250
275 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ 251 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_
OLDNEW
« no previous file with comments | « content/browser/browser_thread_impl.cc ('k') | content/shell/shell_browser_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698