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

Side by Side Diff: cc/trees/blocking_task_runner.h

Issue 485043003: cc: Use correct message loop proxy in BlockingTaskRunner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests. Created 6 years, 3 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 | « cc/cc_tests.gyp ('k') | cc/trees/blocking_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CC_TREES_BLOCKING_TASK_RUNNER_H_ 5 #ifndef CC_TREES_BLOCKING_TASK_RUNNER_H_
6 #define CC_TREES_BLOCKING_TASK_RUNNER_H_ 6 #define CC_TREES_BLOCKING_TASK_RUNNER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // thread. 65 // thread.
66 bool BelongsToCurrentThread(); 66 bool BelongsToCurrentThread();
67 67
68 // Posts a task using the contained SingleThreadTaskRunner unless |capture_| 68 // Posts a task using the contained SingleThreadTaskRunner unless |capture_|
69 // is true. When |capture_| is true, tasks posted will be caught and stored 69 // is true. When |capture_| is true, tasks posted will be caught and stored
70 // until the capturing stops. At that time the tasks will be run directly 70 // until the capturing stops. At that time the tasks will be run directly
71 // instead of being posted to the SingleThreadTaskRunner. 71 // instead of being posted to the SingleThreadTaskRunner.
72 bool PostTask(const tracked_objects::Location& from_here, 72 bool PostTask(const tracked_objects::Location& from_here,
73 const base::Closure& task); 73 const base::Closure& task);
74 74
75 // Forward the tasks to a specific task runner instead of the
danakj 2014/08/26 15:59:00 WDYT of passing this to current() and DCHECKing th
Sami 2014/08/26 16:19:17 The places[1] that call BlockingTaskRunner::curren
76 // MessageLoopProxy which was current when this task runner was constructed.
77 // Must not be called while capturing tasks.
78 void SetTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner);
79
75 private: 80 private:
76 friend class base::RefCountedThreadSafe<BlockingTaskRunner>; 81 friend class base::RefCountedThreadSafe<BlockingTaskRunner>;
77 82
78 explicit BlockingTaskRunner( 83 explicit BlockingTaskRunner(
79 scoped_refptr<base::SingleThreadTaskRunner> task_runner); 84 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
80 virtual ~BlockingTaskRunner(); 85 virtual ~BlockingTaskRunner();
81 86
82 void SetCapture(bool capture); 87 void SetCapture(bool capture);
83 88
84 base::PlatformThreadId thread_id_; 89 base::PlatformThreadId thread_id_;
85 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 90 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
86 91
87 base::Lock lock_; 92 base::Lock lock_;
88 int capture_; 93 int capture_;
89 std::vector<base::Closure> captured_tasks_; 94 std::vector<base::Closure> captured_tasks_;
90 }; 95 };
91 96
92 } // namespace cc 97 } // namespace cc
93 98
94 #endif // CC_TREES_BLOCKING_TASK_RUNNER_H_ 99 #endif // CC_TREES_BLOCKING_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/trees/blocking_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698