Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / public / browser / browser_thread_delegate.h
blobad5fd7e57eba160f8618d46a9823fa5e6bbc60ee
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_PUBLIC_BROWSER_BROWSER_THREAD_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_DELEGATE_H_
8 namespace content {
10 // A class with this type may be registered via
11 // BrowserThread::SetDelegate.
13 // If registered as such, it will schedule to run Init() before the
14 // message loop begins and the schedule InitAsync() as the first
15 // task on its message loop (after the BrowserThread has done its own
16 // initialization), and receive a CleanUp call right after the message
17 // loop ends (and before the BrowserThread has done its own clean-up).
18 class BrowserThreadDelegate {
19 public:
20 virtual ~BrowserThreadDelegate() {}
22 // Called prior to starting the message loop
23 virtual void Init() = 0;
25 // Called as the first task on the thread's message loop.
26 virtual void InitAsync() = 0;
28 // Called just after the message loop ends.
29 virtual void CleanUp() = 0;
32 } // namespace content
34 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_DELEGATE_H_