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

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

Issue 886593002: workers: Map the current thread-id to the WorkerRunLoop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | content/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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_CHILD_WORKER_TASK_RUNNER_H_ 5 #ifndef CONTENT_CHILD_WORKER_TASK_RUNNER_H_
6 #define CONTENT_CHILD_WORKER_TASK_RUNNER_H_ 6 #define CONTENT_CHILD_WORKER_TASK_RUNNER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/atomic_sequence_num.h"
11 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
12 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "base/threading/platform_thread.h"
13 #include "base/threading/thread_local.h" 13 #include "base/threading/thread_local.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "third_party/WebKit/public/platform/WebWorkerRunLoop.h" 15 #include "third_party/WebKit/public/platform/WebWorkerRunLoop.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 class CONTENT_EXPORT WorkerTaskRunner { 19 class CONTENT_EXPORT WorkerTaskRunner {
20 public: 20 public:
21 WorkerTaskRunner(); 21 WorkerTaskRunner();
22 22
(...skipping 12 matching lines...) Expand all
35 // are stopping. It's only valid to call these on a worker thread. 35 // are stopping. It's only valid to call these on a worker thread.
36 void AddStopObserver(Observer* observer); 36 void AddStopObserver(Observer* observer);
37 void RemoveStopObserver(Observer* observer); 37 void RemoveStopObserver(Observer* observer);
38 38
39 void OnWorkerRunLoopStarted(const blink::WebWorkerRunLoop& loop); 39 void OnWorkerRunLoopStarted(const blink::WebWorkerRunLoop& loop);
40 void OnWorkerRunLoopStopped(const blink::WebWorkerRunLoop& loop); 40 void OnWorkerRunLoopStopped(const blink::WebWorkerRunLoop& loop);
41 41
42 private: 42 private:
43 friend class WorkerTaskRunnerTest; 43 friend class WorkerTaskRunnerTest;
44 44
45 typedef std::map<int, blink::WebWorkerRunLoop> IDToLoopMap; 45 typedef std::map<base::PlatformThreadId, blink::WebWorkerRunLoop> IDToLoopMap;
46 46
47 ~WorkerTaskRunner(); 47 ~WorkerTaskRunner();
48 48
49 struct ThreadLocalState; 49 struct ThreadLocalState;
50 base::ThreadLocalPointer<ThreadLocalState> current_tls_; 50 base::ThreadLocalPointer<ThreadLocalState> current_tls_;
51 51
52 base::AtomicSequenceNumber id_sequence_;
53 IDToLoopMap loop_map_; 52 IDToLoopMap loop_map_;
54 base::Lock loop_map_lock_; 53 base::Lock loop_map_lock_;
55 }; 54 };
56 55
57 } // namespace content 56 } // namespace content
58 57
59 #endif // CONTENT_CHILD_WORKER_TASK_RUNNER_H_ 58 #endif // CONTENT_CHILD_WORKER_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/worker_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698