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

Side by Side Diff: chrome/browser/in_process_webkit/webkit_thread.h

Issue 405007: Always start the WebKit thread.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_THREAD_H_ 5 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_THREAD_H_
6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_THREAD_H_ 6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_THREAD_H_
7 7
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/lock.h" 9 #include "base/lock.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "base/thread.h" 12 #include "base/thread.h"
13 #include "chrome/browser/chrome_thread.h" 13 #include "chrome/browser/chrome_thread.h"
14 14
15 class BrowserWebKitClientImpl; 15 class BrowserWebKitClientImpl;
16 16
17 // This is an object that represents WebKit's "main" thread within the browser 17 // This creates a WebKit main thread on instantiation (if not in
18 // process. It should be instantiated and destroyed on the UI thread 18 // --single-process mode) on construction and kills it on deletion.
19 // before/after the IO thread is created/destroyed. All other usage should be
20 // on the IO thread. If the browser is being run in --single-process mode, a
21 // thread will never be spun up.
22 class WebKitThread { 19 class WebKitThread {
23 public: 20 public:
24 // Called from the UI thread. 21 // Called from the UI thread.
25 WebKitThread(); 22 WebKitThread();
26 ~WebKitThread(); 23 ~WebKitThread();
27 24
28 // Creates the WebKit thread if it hasn't been already created. Only call
29 // from the IO thread. Only do fast-path work here.
30 void EnsureInitialized();
31
32 private: 25 private:
33 // Must be private so that we can carefully control its lifetime. 26 // Must be private so that we can carefully control its lifetime.
34 class InternalWebKitThread : public ChromeThread { 27 class InternalWebKitThread : public ChromeThread {
35 public: 28 public:
36 InternalWebKitThread(); 29 InternalWebKitThread();
37 virtual ~InternalWebKitThread(); 30 virtual ~InternalWebKitThread();
38 // Does the actual initialization and shutdown of WebKit. Called at the 31 // Does the actual initialization and shutdown of WebKit. Called at the
39 // beginning and end of the thread's lifetime. 32 // beginning and end of the thread's lifetime.
40 virtual void Init(); 33 virtual void Init();
41 virtual void CleanUp(); 34 virtual void CleanUp();
42 35
43 private: 36 private:
44 // The WebKitClient implementation. Only access on WebKit thread. 37 // The WebKitClient implementation. Only access on WebKit thread.
45 scoped_ptr<BrowserWebKitClientImpl> webkit_client_; 38 scoped_ptr<BrowserWebKitClientImpl> webkit_client_;
46 }; 39 };
47 40
48 // Returns the WebKit thread's message loop or NULL if we're in 41 // Pointer to the actual WebKitThread.
49 // --single-process mode. Do slow-path initialization work here.
50 MessageLoop* InitializeThread();
51
52 // Pointer to the actual WebKitThread. NULL if not yet started. Only modify
53 // from the IO thread while the WebKit thread is not running.
54 scoped_ptr<InternalWebKitThread> webkit_thread_; 42 scoped_ptr<InternalWebKitThread> webkit_thread_;
55 43
56 DISALLOW_COPY_AND_ASSIGN(WebKitThread); 44 DISALLOW_COPY_AND_ASSIGN(WebKitThread);
57 }; 45 };
58 46
59 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_THREAD_H_ 47 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_THREAD_H_
OLDNEW
« no previous file with comments | « chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc ('k') | chrome/browser/in_process_webkit/webkit_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698