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

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

Issue 402049: Revert my last... (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 creates a WebKit main thread on instantiation (if not in 17 // This is an object that represents WebKit's "main" thread within the browser
18 // --single-process mode) on construction and kills it on deletion. 18 // process. It should be instantiated and destroyed on the UI thread
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.
19 class WebKitThread { 22 class WebKitThread {
20 public: 23 public:
21 // Called from the UI thread. 24 // Called from the UI thread.
22 WebKitThread(); 25 WebKitThread();
23 ~WebKitThread(); 26 ~WebKitThread();
24 27
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
25 private: 32 private:
26 // Must be private so that we can carefully control its lifetime. 33 // Must be private so that we can carefully control its lifetime.
27 class InternalWebKitThread : public ChromeThread { 34 class InternalWebKitThread : public ChromeThread {
28 public: 35 public:
29 InternalWebKitThread(); 36 InternalWebKitThread();
30 virtual ~InternalWebKitThread(); 37 virtual ~InternalWebKitThread();
31 // Does the actual initialization and shutdown of WebKit. Called at the 38 // Does the actual initialization and shutdown of WebKit. Called at the
32 // beginning and end of the thread's lifetime. 39 // beginning and end of the thread's lifetime.
33 virtual void Init(); 40 virtual void Init();
34 virtual void CleanUp(); 41 virtual void CleanUp();
35 42
36 private: 43 private:
37 // The WebKitClient implementation. Only access on WebKit thread. 44 // The WebKitClient implementation. Only access on WebKit thread.
38 scoped_ptr<BrowserWebKitClientImpl> webkit_client_; 45 scoped_ptr<BrowserWebKitClientImpl> webkit_client_;
39 }; 46 };
40 47
41 // Pointer to the actual WebKitThread. 48 // Returns the WebKit thread's message loop or NULL if we're in
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.
42 scoped_ptr<InternalWebKitThread> webkit_thread_; 54 scoped_ptr<InternalWebKitThread> webkit_thread_;
43 55
44 DISALLOW_COPY_AND_ASSIGN(WebKitThread); 56 DISALLOW_COPY_AND_ASSIGN(WebKitThread);
45 }; 57 };
46 58
47 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_THREAD_H_ 59 #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