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

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

Issue 2726523002: Pass Callback to TaskRunner by value and consume it on invocation (1) (Closed)
Patch Set: erase Closure* Created 3 years, 8 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
« no previous file with comments | « components/user_manager/fake_user_manager.cc ('k') | content/browser/browser_thread_impl.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) 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_BROWSER_BROWSER_THREAD_IMPL_H_ 5 #ifndef CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_
6 #define CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_ 6 #define CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_
7 7
8 #include "base/callback.h"
8 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
9 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "base/time/time.h"
11 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
12 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
13 15
16 namespace base {
17 class MessageLoop;
18 class RunLoop;
19 }
20
21 namespace tracked_objects {
22 class Location;
23 }
24
14 namespace content { 25 namespace content {
15 26
16 // Very few users should use this directly. To mock BrowserThreads, tests should 27 // Very few users should use this directly. To mock BrowserThreads, tests should
17 // use TestBrowserThreadBundle instead. 28 // use TestBrowserThreadBundle instead.
18 class CONTENT_EXPORT BrowserThreadImpl : public BrowserThread, 29 class CONTENT_EXPORT BrowserThreadImpl : public BrowserThread,
19 public base::Thread { 30 public base::Thread {
20 public: 31 public:
21 // Construct a BrowserThreadImpl with the supplied identifier. It is an error 32 // Construct a BrowserThreadImpl with the supplied identifier. It is an error
22 // to construct a BrowserThreadImpl that already exists. 33 // to construct a BrowserThreadImpl that already exists.
23 explicit BrowserThreadImpl(BrowserThread::ID identifier); 34 explicit BrowserThreadImpl(BrowserThread::ID identifier);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // The following are unique function names that makes it possible to tell 78 // The following are unique function names that makes it possible to tell
68 // the thread id from the callstack alone in crash dumps. 79 // the thread id from the callstack alone in crash dumps.
69 void UIThreadRun(base::RunLoop* run_loop); 80 void UIThreadRun(base::RunLoop* run_loop);
70 void DBThreadRun(base::RunLoop* run_loop); 81 void DBThreadRun(base::RunLoop* run_loop);
71 void FileThreadRun(base::RunLoop* run_loop); 82 void FileThreadRun(base::RunLoop* run_loop);
72 void FileUserBlockingThreadRun(base::RunLoop* run_loop); 83 void FileUserBlockingThreadRun(base::RunLoop* run_loop);
73 void ProcessLauncherThreadRun(base::RunLoop* run_loop); 84 void ProcessLauncherThreadRun(base::RunLoop* run_loop);
74 void CacheThreadRun(base::RunLoop* run_loop); 85 void CacheThreadRun(base::RunLoop* run_loop);
75 void IOThreadRun(base::RunLoop* run_loop); 86 void IOThreadRun(base::RunLoop* run_loop);
76 87
77 static bool PostTaskHelper( 88 static bool PostTaskHelper(BrowserThread::ID identifier,
78 BrowserThread::ID identifier, 89 const tracked_objects::Location& from_here,
79 const tracked_objects::Location& from_here, 90 base::Closure task,
80 const base::Closure& task, 91 base::TimeDelta delay,
81 base::TimeDelta delay, 92 bool nestable);
82 bool nestable);
83 93
84 // Common initialization code for the constructors. 94 // Common initialization code for the constructors.
85 void Initialize(); 95 void Initialize();
86 96
87 // For testing. 97 // For testing.
88 friend class ContentTestSuiteBaseListener; 98 friend class ContentTestSuiteBaseListener;
89 friend class TestBrowserThreadBundle; 99 friend class TestBrowserThreadBundle;
90 static void FlushThreadPoolHelperForTesting(); 100 static void FlushThreadPoolHelperForTesting();
91 101
92 // The identifier of this thread. Only one thread can exist with a given 102 // The identifier of this thread. Only one thread can exist with a given
93 // identifier at a given time. 103 // identifier at a given time.
94 ID identifier_; 104 ID identifier_;
95 }; 105 };
96 106
97 } // namespace content 107 } // namespace content
98 108
99 #endif // CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_ 109 #endif // CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_
OLDNEW
« no previous file with comments | « components/user_manager/fake_user_manager.cc ('k') | content/browser/browser_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698