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

Side by Side Diff: webkit/child/worker_task_runner.h

Issue 16834004: move webkit/glue/worker_task_* to webkit/child/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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
« no previous file with comments | « webkit/child/webkitplatformsupport_child_impl.cc ('k') | webkit/child/worker_task_runner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_GLUE_WORKER_TASK_RUNNER_H_ 5 #ifndef WEBKIT_CHILD_WORKER_TASK_RUNNER_H_
6 #define WEBKIT_GLUE_WORKER_TASK_RUNNER_H_ 6 #define WEBKIT_CHILD_WORKER_TASK_RUNNER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "base/threading/thread_local.h" 13 #include "base/threading/thread_local.h"
14 #include "third_party/WebKit/public/platform/WebWorkerRunLoop.h" 14 #include "third_party/WebKit/public/platform/WebWorkerRunLoop.h"
15 #include "webkit/glue/webkit_glue_export.h" 15 #include "webkit/child/webkit_child_export.h"
16 16
17 namespace webkit_glue { 17 namespace webkit_glue {
18 18
19 class WEBKIT_GLUE_EXPORT WorkerTaskRunner { 19 class WEBKIT_CHILD_EXPORT WorkerTaskRunner {
20 public: 20 public:
21 WorkerTaskRunner(); 21 WorkerTaskRunner();
22 22
23 bool PostTask(int id, const base::Closure& task); 23 bool PostTask(int id, const base::Closure& task);
24 int CurrentWorkerId(); 24 int CurrentWorkerId();
25 static WorkerTaskRunner* Instance(); 25 static WorkerTaskRunner* Instance();
26 26
27 class WEBKIT_GLUE_EXPORT Observer { 27 class WEBKIT_CHILD_EXPORT Observer {
28 public: 28 public:
29 virtual ~Observer() {} 29 virtual ~Observer() {}
30 virtual void OnWorkerRunLoopStopped() = 0; 30 virtual void OnWorkerRunLoopStopped() = 0;
31 }; 31 };
32 // Add/Remove an observer that will get notified when the current worker run 32 // Add/Remove an observer that will get notified when the current worker run
33 // loop is stopping. This observer will not get notified when other threads 33 // loop is stopping. This observer will not get notified when other threads
34 // are stopping. It's only valid to call these on a worker thread. 34 // are stopping. It's only valid to call these on a worker thread.
35 void AddStopObserver(Observer* observer); 35 void AddStopObserver(Observer* observer);
36 void RemoveStopObserver(Observer* observer); 36 void RemoveStopObserver(Observer* observer);
37 37
38 private: 38 private:
39 friend class WebKitPlatformSupportImpl; 39 friend class WebKitPlatformSupportChildImpl;
40 friend class WorkerTaskRunnerTest; 40 friend class WorkerTaskRunnerTest;
41 41
42 typedef std::map<int, WebKit::WebWorkerRunLoop> IDToLoopMap; 42 typedef std::map<int, WebKit::WebWorkerRunLoop> IDToLoopMap;
43 43
44 ~WorkerTaskRunner(); 44 ~WorkerTaskRunner();
45 void OnWorkerRunLoopStarted(const WebKit::WebWorkerRunLoop& loop); 45 void OnWorkerRunLoopStarted(const WebKit::WebWorkerRunLoop& loop);
46 void OnWorkerRunLoopStopped(const WebKit::WebWorkerRunLoop& loop); 46 void OnWorkerRunLoopStopped(const WebKit::WebWorkerRunLoop& loop);
47 47
48 struct ThreadLocalState; 48 struct ThreadLocalState;
49 base::ThreadLocalPointer<ThreadLocalState> current_tls_; 49 base::ThreadLocalPointer<ThreadLocalState> current_tls_;
50 50
51 base::AtomicSequenceNumber id_sequence_; 51 base::AtomicSequenceNumber id_sequence_;
52 IDToLoopMap loop_map_; 52 IDToLoopMap loop_map_;
53 base::Lock loop_map_lock_; 53 base::Lock loop_map_lock_;
54 }; 54 };
55 55
56 } // namespace webkit_glue 56 } // namespace webkit_glue
57 57
58 #endif // WEBKIT_GLUE_WORKER_TASK_RUNNER_H_ 58 #endif // WEBKIT_CHILD_WORKER_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « webkit/child/webkitplatformsupport_child_impl.cc ('k') | webkit/child/worker_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698