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

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
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | content/browser/browser_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) 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 #include "base/callback.h"
10 #include "base/synchronization/lock.h"
11 #include "base/task.h"
12 #include "base/threading/thread.h"
13
9 #if defined(UNIT_TEST) 14 #if defined(UNIT_TEST)
10 #include "base/logging.h" 15 #include "base/logging.h"
11 #endif // UNIT_TEST 16 #endif // UNIT_TEST
12 #include "base/synchronization/lock.h"
13 #include "base/task.h"
14 #include "base/threading/thread.h"
15 17
16 namespace base { 18 namespace base {
17 class MessageLoopProxy; 19 class MessageLoopProxy;
18 } 20 }
19 21
20 /////////////////////////////////////////////////////////////////////////////// 22 ///////////////////////////////////////////////////////////////////////////////
21 // BrowserThread 23 // BrowserThread
22 // 24 //
23 // This class represents a thread that is known by a browser-wide name. For 25 // This class represents a thread that is known by a browser-wide name. For
24 // example, there is one IO thread for the entire browser process, and various 26 // example, there is one IO thread for the entire browser process, and various
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 100
99 virtual ~BrowserThread(); 101 virtual ~BrowserThread();
100 102
101 // These are the same methods in message_loop.h, but are guaranteed to either 103 // 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. 104 // 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 105 // 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 106 // 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. 107 // the target thread may already have a Quit message in its queue.
106 static bool PostTask(ID identifier, 108 static bool PostTask(ID identifier,
107 const tracked_objects::Location& from_here, 109 const tracked_objects::Location& from_here,
110 const base::Closure& task);
111 static bool PostDelayedTask(ID identifier,
112 const tracked_objects::Location& from_here,
113 const base::Closure& task,
114 int64 delay_ms);
115 static bool PostNonNestableTask(ID identifier,
116 const tracked_objects::Location& from_here,
117 const base::Closure& task);
118 static bool PostNonNestableDelayedTask(
119 ID identifier,
120 const tracked_objects::Location& from_here,
121 const base::Closure& task,
122 int64 delay_ms);
123
124 // TODO(brettw) remove these when Task->Closure conversion is done.
125 static bool PostTask(ID identifier,
126 const tracked_objects::Location& from_here,
108 Task* task); 127 Task* task);
109 static bool PostDelayedTask(ID identifier, 128 static bool PostDelayedTask(ID identifier,
110 const tracked_objects::Location& from_here, 129 const tracked_objects::Location& from_here,
111 Task* task, 130 Task* task,
112 int64 delay_ms); 131 int64 delay_ms);
113 static bool PostNonNestableTask(ID identifier, 132 static bool PostNonNestableTask(ID identifier,
114 const tracked_objects::Location& from_here, 133 const tracked_objects::Location& from_here,
115 Task* task); 134 Task* task);
116 static bool PostNonNestableDelayedTask( 135 static bool PostNonNestableDelayedTask(
117 ID identifier, 136 ID identifier,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 struct DeleteOnUIThread : public DeleteOnThread<UI> { }; 215 struct DeleteOnUIThread : public DeleteOnThread<UI> { };
197 struct DeleteOnIOThread : public DeleteOnThread<IO> { }; 216 struct DeleteOnIOThread : public DeleteOnThread<IO> { };
198 struct DeleteOnFileThread : public DeleteOnThread<FILE> { }; 217 struct DeleteOnFileThread : public DeleteOnThread<FILE> { };
199 struct DeleteOnDBThread : public DeleteOnThread<DB> { }; 218 struct DeleteOnDBThread : public DeleteOnThread<DB> { };
200 struct DeleteOnWebKitThread : public DeleteOnThread<WEBKIT> { }; 219 struct DeleteOnWebKitThread : public DeleteOnThread<WEBKIT> { };
201 220
202 private: 221 private:
203 // Common initialization code for the constructors. 222 // Common initialization code for the constructors.
204 void Initialize(); 223 void Initialize();
205 224
225 // TODO(brettw) remove this variant when Task->Closure migration is complete.
206 static bool PostTaskHelper( 226 static bool PostTaskHelper(
207 ID identifier, 227 ID identifier,
208 const tracked_objects::Location& from_here, 228 const tracked_objects::Location& from_here,
209 Task* task, 229 Task* task,
210 int64 delay_ms, 230 int64 delay_ms,
211 bool nestable); 231 bool nestable);
232 static bool PostTaskHelper(
233 ID identifier,
234 const tracked_objects::Location& from_here,
235 const base::Closure& task,
236 int64 delay_ms,
237 bool nestable);
212 238
213 // The identifier of this thread. Only one thread can exist with a given 239 // The identifier of this thread. Only one thread can exist with a given
214 // identifier at a given time. 240 // identifier at a given time.
215 ID identifier_; 241 ID identifier_;
216 242
217 // This lock protects |browser_threads_|. Do not read or modify that array 243 // This lock protects |browser_threads_|. Do not read or modify that array
218 // without holding this lock. Do not block while holding this lock. 244 // without holding this lock. Do not block while holding this lock.
219 static base::Lock lock_; 245 static base::Lock lock_;
220 246
221 // An array of the BrowserThread objects. This array is protected by |lock_|. 247 // 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 248 // 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 249 // on the UI thread by the g_browser_process object. BrowserThreads remove
224 // themselves from this array upon destruction. 250 // themselves from this array upon destruction.
225 static BrowserThread* browser_threads_[ID_COUNT]; 251 static BrowserThread* browser_threads_[ID_COUNT];
226 }; 252 };
227 253
228 #endif // CONTENT_BROWSER_BROWSER_THREAD_H_ 254 #endif // CONTENT_BROWSER_BROWSER_THREAD_H_
OLDNEW
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | content/browser/browser_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698