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

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

Issue 7044012: Support getting the font list in Pepper. This currently only works out of (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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) 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_BROWSER_BROWSER_THREAD_H_ 5 #ifndef CONTENT_BROWSER_BROWSER_THREAD_H_
6 #define CONTENT_BROWSER_BROWSER_THREAD_H_ 6 #define CONTENT_BROWSER_BROWSER_THREAD_H_
7 #pragma once 7 #pragma once
8 8
9 #if defined(UNIT_TEST) 9 #if defined(UNIT_TEST)
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #endif // UNIT_TEST 11 #endif // UNIT_TEST
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "base/callback.h"
viettrungluu 2011/05/18 20:21:18 Oooh, alphabetical order!
13 #include "base/task.h" 14 #include "base/task.h"
14 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
15 16
16 namespace base { 17 namespace base {
17 class MessageLoopProxy; 18 class MessageLoopProxy;
18 } 19 }
19 20
20 /////////////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////////////
21 // BrowserThread 22 // BrowserThread
22 // 23 //
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 99
99 virtual ~BrowserThread(); 100 virtual ~BrowserThread();
100 101
101 // These are the same methods in message_loop.h, but are guaranteed to either 102 // These are the same methods in message_loop.h, but are guaranteed to either
102 // get posted to the MessageLoop if it's still alive, or be deleted otherwise. 103 // get posted to the MessageLoop if it's still alive, or be deleted otherwise.
103 // They return true iff the thread existed and the task was posted. Note that 104 // They return true iff the thread existed and the task was posted. Note that
104 // even if the task is posted, there's no guarantee that it will run, since 105 // even if the task is posted, there's no guarantee that it will run, since
105 // the target thread may already have a Quit message in its queue. 106 // the target thread may already have a Quit message in its queue.
106 static bool PostTask(ID identifier, 107 static bool PostTask(ID identifier,
107 const tracked_objects::Location& from_here, 108 const tracked_objects::Location& from_here,
109 const base::Closure& task);
110 static bool PostDelayedTask(ID identifier,
111 const tracked_objects::Location& from_here,
112 const base::Closure& task,
113 int64 delay_ms);
114 static bool PostNonNestableTask(ID identifier,
115 const tracked_objects::Location& from_here,
116 const base::Closure& task);
117 static bool PostNonNestableDelayedTask(
118 ID identifier,
119 const tracked_objects::Location& from_here,
120 const base::Closure& task,
121 int64 delay_ms);
122
123 // TODO(brettw) remove these when Task->Closure conversion is done.
124 static bool PostTask(ID identifier,
125 const tracked_objects::Location& from_here,
108 Task* task); 126 Task* task);
109 static bool PostDelayedTask(ID identifier, 127 static bool PostDelayedTask(ID identifier,
110 const tracked_objects::Location& from_here, 128 const tracked_objects::Location& from_here,
111 Task* task, 129 Task* task,
112 int64 delay_ms); 130 int64 delay_ms);
113 static bool PostNonNestableTask(ID identifier, 131 static bool PostNonNestableTask(ID identifier,
114 const tracked_objects::Location& from_here, 132 const tracked_objects::Location& from_here,
115 Task* task); 133 Task* task);
116 static bool PostNonNestableDelayedTask( 134 static bool PostNonNestableDelayedTask(
117 ID identifier, 135 ID identifier,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 struct DeleteOnUIThread : public DeleteOnThread<UI> { }; 214 struct DeleteOnUIThread : public DeleteOnThread<UI> { };
197 struct DeleteOnIOThread : public DeleteOnThread<IO> { }; 215 struct DeleteOnIOThread : public DeleteOnThread<IO> { };
198 struct DeleteOnFileThread : public DeleteOnThread<FILE> { }; 216 struct DeleteOnFileThread : public DeleteOnThread<FILE> { };
199 struct DeleteOnDBThread : public DeleteOnThread<DB> { }; 217 struct DeleteOnDBThread : public DeleteOnThread<DB> { };
200 struct DeleteOnWebKitThread : public DeleteOnThread<WEBKIT> { }; 218 struct DeleteOnWebKitThread : public DeleteOnThread<WEBKIT> { };
201 219
202 private: 220 private:
203 // Common initialization code for the constructors. 221 // Common initialization code for the constructors.
204 void Initialize(); 222 void Initialize();
205 223
224 // TODO(brettw) remove this variant when Task->Closure migration is complete.
206 static bool PostTaskHelper( 225 static bool PostTaskHelper(
207 ID identifier, 226 ID identifier,
208 const tracked_objects::Location& from_here, 227 const tracked_objects::Location& from_here,
209 Task* task, 228 Task* task,
210 int64 delay_ms, 229 int64 delay_ms,
211 bool nestable); 230 bool nestable);
231 static bool PostTaskHelper(
232 ID identifier,
233 const tracked_objects::Location& from_here,
234 const base::Closure& task,
235 int64 delay_ms,
236 bool nestable);
212 237
213 // The identifier of this thread. Only one thread can exist with a given 238 // The identifier of this thread. Only one thread can exist with a given
214 // identifier at a given time. 239 // identifier at a given time.
215 ID identifier_; 240 ID identifier_;
216 241
217 // This lock protects |browser_threads_|. Do not read or modify that array 242 // This lock protects |browser_threads_|. Do not read or modify that array
218 // without holding this lock. Do not block while holding this lock. 243 // without holding this lock. Do not block while holding this lock.
219 static base::Lock lock_; 244 static base::Lock lock_;
220 245
221 // An array of the BrowserThread objects. This array is protected by |lock_|. 246 // An array of the BrowserThread objects. This array is protected by |lock_|.
222 // The threads are not owned by this array. Typically, the threads are owned 247 // The threads are not owned by this array. Typically, the threads are owned
223 // on the UI thread by the g_browser_process object. BrowserThreads remove 248 // on the UI thread by the g_browser_process object. BrowserThreads remove
224 // themselves from this array upon destruction. 249 // themselves from this array upon destruction.
225 static BrowserThread* browser_threads_[ID_COUNT]; 250 static BrowserThread* browser_threads_[ID_COUNT];
226 }; 251 };
227 252
228 #endif // CONTENT_BROWSER_BROWSER_THREAD_H_ 253 #endif // CONTENT_BROWSER_BROWSER_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698