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

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

Issue 8274012: Wait for URLBlacklist update tasks on automation tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added BrowserThread::WaitForPendingTasksOn, removed SignalingTask Created 9 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 | « chrome/test/base/signaling_task.cc ('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" 9 #include "base/callback.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 // Callable on any thread. Returns whether the threads message loop is valid. 162 // Callable on any thread. Returns whether the threads message loop is valid.
163 // If this returns false it means the thread is in the process of shutting 163 // If this returns false it means the thread is in the process of shutting
164 // down. 164 // down.
165 static bool IsMessageLoopValid(ID identifier); 165 static bool IsMessageLoopValid(ID identifier);
166 166
167 // If the current message loop is one of the known threads, returns true and 167 // If the current message loop is one of the known threads, returns true and
168 // sets identifier to its ID. Otherwise returns false. 168 // sets identifier to its ID. Otherwise returns false.
169 static bool GetCurrentThreadIdentifier(ID* identifier); 169 static bool GetCurrentThreadIdentifier(ID* identifier);
170 170
171 // Runs all the current pending tasks on the given thread's message loop.
172 // This call blocks until those tasks are executed, effectively making the
173 // current thread block on |identifier|. Avoid using this.
174 // Returns false if |identifier| is the current thread, or a task couldn't be
175 // posted to |identifier|'s message loop.
176 static bool WaitForPendingTasksOn(ID identifier);
jam 2011/10/14 17:19:30 this is most certainly a function that we don't wa
177
171 // Callers can hold on to a refcounted MessageLoopProxy beyond the lifetime 178 // Callers can hold on to a refcounted MessageLoopProxy beyond the lifetime
172 // of the thread. 179 // of the thread.
173 static scoped_refptr<base::MessageLoopProxy> GetMessageLoopProxyForThread( 180 static scoped_refptr<base::MessageLoopProxy> GetMessageLoopProxyForThread(
174 ID identifier); 181 ID identifier);
175 182
176 // Use these templates in conjuction with RefCountedThreadSafe when you want 183 // Use these templates in conjuction with RefCountedThreadSafe when you want
177 // to ensure that an object is deleted on a specific thread. This is needed 184 // to ensure that an object is deleted on a specific thread. This is needed
178 // when an object can hop between threads (i.e. IO -> FILE -> IO), and thread 185 // when an object can hop between threads (i.e. IO -> FILE -> IO), and thread
179 // switching delays can mean that the final IO tasks executes before the FILE 186 // switching delays can mean that the final IO tasks executes before the FILE
180 // task's stack unwinds. This would lead to the object destructing on the 187 // task's stack unwinds. This would lead to the object destructing on the
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 static base::Lock lock_; 249 static base::Lock lock_;
243 250
244 // An array of the BrowserThread objects. This array is protected by |lock_|. 251 // An array of the BrowserThread objects. This array is protected by |lock_|.
245 // The threads are not owned by this array. Typically, the threads are owned 252 // The threads are not owned by this array. Typically, the threads are owned
246 // on the UI thread by the g_browser_process object. BrowserThreads remove 253 // on the UI thread by the g_browser_process object. BrowserThreads remove
247 // themselves from this array upon destruction. 254 // themselves from this array upon destruction.
248 static BrowserThread* browser_threads_[ID_COUNT]; 255 static BrowserThread* browser_threads_[ID_COUNT];
249 }; 256 };
250 257
251 #endif // CONTENT_BROWSER_BROWSER_THREAD_H_ 258 #endif // CONTENT_BROWSER_BROWSER_THREAD_H_
OLDNEW
« no previous file with comments | « chrome/test/base/signaling_task.cc ('k') | content/browser/browser_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698