Ignore title parameter for navigator.registerProtocolHandler
[chromium-blink-merge.git] / content / browser / browser_thread_impl.h
blob167cc3b85a1f0a6aaa0b5a0bbd9d985904450f1e
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_
6 #define CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_
8 #include "base/threading/thread.h"
9 #include "content/common/content_export.h"
10 #include "content/public/browser/browser_thread.h"
12 namespace content {
14 class CONTENT_EXPORT BrowserThreadImpl : public BrowserThread,
15 public base::Thread {
16 public:
17 // Construct a BrowserThreadImpl with the supplied identifier. It is an error
18 // to construct a BrowserThreadImpl that already exists.
19 explicit BrowserThreadImpl(BrowserThread::ID identifier);
21 // Special constructor for the main (UI) thread and unittests. If a
22 // |message_loop| is provied, we use a dummy thread here since the main
23 // thread already exists.
24 BrowserThreadImpl(BrowserThread::ID identifier,
25 base::MessageLoop* message_loop);
26 virtual ~BrowserThreadImpl();
28 static void ShutdownThreadPool();
30 protected:
31 virtual void Init() OVERRIDE;
32 virtual void Run(base::MessageLoop* message_loop) OVERRIDE;
33 virtual void CleanUp() OVERRIDE;
35 private:
36 // We implement all the functionality of the public BrowserThread
37 // functions, but state is stored in the BrowserThreadImpl to keep
38 // the API cleaner. Therefore make BrowserThread a friend class.
39 friend class BrowserThread;
41 // The following are unique function names that makes it possible to tell
42 // the thread id from the callstack alone in crash dumps.
43 void UIThreadRun(base::MessageLoop* message_loop);
44 void DBThreadRun(base::MessageLoop* message_loop);
45 void FileThreadRun(base::MessageLoop* message_loop);
46 void FileUserBlockingThreadRun(base::MessageLoop* message_loop);
47 void ProcessLauncherThreadRun(base::MessageLoop* message_loop);
48 void CacheThreadRun(base::MessageLoop* message_loop);
49 void IOThreadRun(base::MessageLoop* message_loop);
51 static bool PostTaskHelper(
52 BrowserThread::ID identifier,
53 const tracked_objects::Location& from_here,
54 const base::Closure& task,
55 base::TimeDelta delay,
56 bool nestable);
58 // Common initialization code for the constructors.
59 void Initialize();
61 // For testing.
62 friend class ContentTestSuiteBaseListener;
63 friend class TestBrowserThreadBundle;
64 static void FlushThreadPoolHelper();
66 // The identifier of this thread. Only one thread can exist with a given
67 // identifier at a given time.
68 ID identifier_;
71 } // namespace content
73 #endif // CONTENT_BROWSER_BROWSER_THREAD_IMPL_H_