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

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

Issue 165373004: Move WorkerTaskRunner to content/child. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « content/child/worker_task_runner.h ('k') | content/child/worker_task_runner_unittest.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 #include "content/child/worker_task_runner.h"
6
5 #include "base/callback.h" 7 #include "base/callback.h"
6 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
9 #include "base/observer_list.h" 11 #include "base/observer_list.h"
10 #include "webkit/child/worker_task_runner.h"
11 12
12 using blink::WebWorkerRunLoop; 13 using blink::WebWorkerRunLoop;
13 14
15 namespace content {
16
14 namespace { 17 namespace {
15 18
16 class RunClosureTask : public WebWorkerRunLoop::Task { 19 class RunClosureTask : public WebWorkerRunLoop::Task {
17 public: 20 public:
18 RunClosureTask(const base::Closure& task) : task_(task) {} 21 RunClosureTask(const base::Closure& task) : task_(task) {}
19 virtual ~RunClosureTask() {} 22 virtual ~RunClosureTask() {}
20 virtual void Run() { 23 virtual void Run() {
21 task_.Run(); 24 task_.Run();
22 } 25 }
23 private: 26 private:
24 base::Closure task_; 27 base::Closure task_;
25 }; 28 };
26 29
27 } // unnamed namespace 30 } // namespace
28
29 namespace webkit_glue {
30 31
31 struct WorkerTaskRunner::ThreadLocalState { 32 struct WorkerTaskRunner::ThreadLocalState {
32 ThreadLocalState(int id, const WebWorkerRunLoop& loop) 33 ThreadLocalState(int id, const WebWorkerRunLoop& loop)
33 : id_(id), run_loop_(loop) { 34 : id_(id), run_loop_(loop) {
34 } 35 }
35 int id_; 36 int id_;
36 WebWorkerRunLoop run_loop_; 37 WebWorkerRunLoop run_loop_;
37 ObserverList<WorkerTaskRunner::Observer> stop_observers_; 38 ObserverList<WorkerTaskRunner::Observer> stop_observers_;
38 }; 39 };
39 40
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 OnWorkerRunLoopStopped()); 102 OnWorkerRunLoopStopped());
102 { 103 {
103 base::AutoLock locker(loop_map_lock_); 104 base::AutoLock locker(loop_map_lock_);
104 DCHECK(loop_map_[CurrentWorkerId()] == loop); 105 DCHECK(loop_map_[CurrentWorkerId()] == loop);
105 loop_map_.erase(CurrentWorkerId()); 106 loop_map_.erase(CurrentWorkerId());
106 } 107 }
107 delete current_tls_.Get(); 108 delete current_tls_.Get();
108 current_tls_.Set(NULL); 109 current_tls_.Set(NULL);
109 } 110 }
110 111
111 } // namespace webkit_glue 112 } // namespace content
OLDNEW
« no previous file with comments | « content/child/worker_task_runner.h ('k') | content/child/worker_task_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698