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

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

Issue 155845: DOM Storage: Add browser-process IPC code + tweak the WebKit Thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months 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"
(...skipping 17 matching lines...) Expand all
28 // Returns the message loop for the WebKit thread unless we're in 28 // Returns the message loop for the WebKit thread unless we're in
29 // --single-processuntil mode, in which case it'll return NULL. Only call 29 // --single-processuntil mode, in which case it'll return NULL. Only call
30 // from the IO thread. Only do fast-path work here. 30 // from the IO thread. Only do fast-path work here.
31 MessageLoop* GetMessageLoop() { 31 MessageLoop* GetMessageLoop() {
32 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); 32 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
33 if (!webkit_thread_.get()) 33 if (!webkit_thread_.get())
34 return InitializeThread(); 34 return InitializeThread();
35 return webkit_thread_->message_loop(); 35 return webkit_thread_->message_loop();
36 } 36 }
37 37
38 // Called from the IO thread. Notifies us that it's no longer safe to post
39 // tasks to the IO thread.
40 void Shutdown();
41
42 // Post a task to the IO thread if we haven't yet been told to shut down.
43 // Only call from the WebKit thread.
44 bool PostIOThreadTask(const tracked_objects::Location& from_here,
45 Task* task);
46
38 private: 47 private:
39 // Must be private so that we can carefully control its lifetime. 48 // Must be private so that we can carefully control its lifetime.
40 class InternalWebKitThread : public ChromeThread { 49 class InternalWebKitThread : public ChromeThread {
41 public: 50 public:
42 InternalWebKitThread(); 51 InternalWebKitThread();
43 virtual ~InternalWebKitThread() { } 52 virtual ~InternalWebKitThread() { }
44 // Does the actual initialization and shutdown of WebKit. Called at the 53 // Does the actual initialization and shutdown of WebKit. Called at the
45 // beginning and end of the thread's lifetime. 54 // beginning and end of the thread's lifetime.
46 virtual void Init(); 55 virtual void Init();
47 virtual void CleanUp(); 56 virtual void CleanUp();
48 57
49 private: 58 private:
50 BrowserWebKitClientImpl* webkit_client_; 59 BrowserWebKitClientImpl* webkit_client_;
51 }; 60 };
52 61
53 // Returns the WebKit thread's message loop or NULL if we're in 62 // Returns the WebKit thread's message loop or NULL if we're in
54 // --single-process mode. Do slow-path initialization work here. 63 // --single-process mode. Do slow-path initialization work here.
55 MessageLoop* InitializeThread(); 64 MessageLoop* InitializeThread();
56 65
57 // Pointer to the actual WebKitThread. NULL if not yet started. Only modify 66 // Pointer to the actual WebKitThread. NULL if not yet started. Only modify
58 // from the IO thread while the WebKit thread is not running. 67 // from the IO thread while the WebKit thread is not running.
59 scoped_ptr<InternalWebKitThread> webkit_thread_; 68 scoped_ptr<InternalWebKitThread> webkit_thread_;
60 69
70 // A pointer to the IO message loop. This is nulled out when Shutdown() is
71 // called. Only access under the io_message_loop_lock_.
72 MessageLoop* io_message_loop_;
73 Lock io_message_loop_lock_;
74
61 DISALLOW_COPY_AND_ASSIGN(WebKitThread); 75 DISALLOW_COPY_AND_ASSIGN(WebKitThread);
62 }; 76 };
63 77
64 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_WEBKIT_THREAD_H_ 78 #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