Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / web / public / web_thread_delegate.h
blob28100052ec1093604104b46b8609483ac44782c5
1 // Copyright 2015 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 IOS_WEB_PUBLIC_WEB_THREAD_DELEGATE_H_
6 #define IOS_WEB_PUBLIC_WEB_THREAD_DELEGATE_H_
8 namespace web {
10 // A class with this type may be registered via WebThread::SetDelegate.
11 // TODO(stuartmorgan): Currently the above is not actually true; because
12 // web can currently be build with either its own thread implementation, or
13 // the content thread implementation, WebThread doesn't have SetDelegate
14 // (since it can't be easily be passed through to BrowserThread::SetDelegate).
15 // Once BrowserThread isn't being used by Chrome, SetDelegate will become
16 // public.
18 // If registered as such, it will schedule to run Init() before the
19 // message loop begins and the schedule InitAsync() as the first
20 // task on its message loop (after the WebThread has done its own
21 // initialization), and receive a CleanUp call right after the message
22 // loop ends (and before the WebThread has done its own clean-up).
23 class WebThreadDelegate {
24 public:
25 virtual ~WebThreadDelegate() {}
27 // Called prior to starting the message loop
28 virtual void Init() = 0;
30 // Called as the first task on the thread's message loop.
31 virtual void InitAsync() = 0;
33 // Called just after the message loop ends.
34 virtual void CleanUp() = 0;
37 } // namespace web
39 #endif // IOS_WEB_PUBLIC_WEB_THREAD_DELEGATE_H_