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_IN_PROCESS_WEBKIT_WEBKIT_THREAD_H_
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_THREAD_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/threading/thread.h"
11 #include "content/browser/browser_thread_impl.h"
12 #include "content/common/content_export.h"
15 class BrowserWebKitPlatformSupportImpl
;
17 // This creates a WebKit main thread on instantiation (if not in
18 // --single-process mode) on construction and kills it on deletion.
19 class CONTENT_EXPORT WebKitThread
{
21 // Called from the UI thread.
27 // Must be private so that we can carefully control its lifetime.
28 class InternalWebKitThread
: public BrowserThreadImpl
{
30 InternalWebKitThread();
31 virtual ~InternalWebKitThread();
32 // Does the actual initialization and shutdown of WebKit. Called at the
33 // beginning and end of the thread's lifetime.
34 virtual void Init() OVERRIDE
;
35 virtual void CleanUp() OVERRIDE
;
38 // The WebKitPlatformSupport implementation. Only access on WebKit thread.
39 scoped_ptr
<BrowserWebKitPlatformSupportImpl
> webkit_platform_support_
;
42 // Pointer to the actual WebKitThread.
43 scoped_ptr
<InternalWebKitThread
> webkit_thread_
;
45 DISALLOW_COPY_AND_ASSIGN(WebKitThread
);
48 } // namespace content
50 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_THREAD_H_