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

Side by Side Diff: extensions/common/one_shot_event.cc

Issue 15759013: Update extensions/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « extensions/common/matcher/url_matcher_factory_unittest.cc ('k') | no next file » | 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 #include "extensions/common/one_shot_event.h" 5 #include "extensions/common/one_shot_event.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/task_runner.h" 10 #include "base/task_runner.h"
11 11
12 using base::TaskRunner; 12 using base::TaskRunner;
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 struct OneShotEvent::TaskInfo { 16 struct OneShotEvent::TaskInfo {
17 TaskInfo() {} 17 TaskInfo() {}
18 TaskInfo(const tracked_objects::Location& from_here, 18 TaskInfo(const tracked_objects::Location& from_here,
19 const scoped_refptr<TaskRunner>& runner, 19 const scoped_refptr<TaskRunner>& runner,
20 const base::Closure& task) 20 const base::Closure& task)
21 : from_here(from_here), runner(runner), task(task) { 21 : from_here(from_here), runner(runner), task(task) {
22 CHECK(runner); // Detect mistakes with a decent stack frame. 22 CHECK(runner.get()); // Detect mistakes with a decent stack frame.
23 } 23 }
24 tracked_objects::Location from_here; 24 tracked_objects::Location from_here;
25 scoped_refptr<TaskRunner> runner; 25 scoped_refptr<TaskRunner> runner;
26 base::Closure task; 26 base::Closure task;
27 }; 27 };
28 28
29 OneShotEvent::OneShotEvent() : signaled_(false) { 29 OneShotEvent::OneShotEvent() : signaled_(false) {
30 // It's acceptable to construct the OneShotEvent on one thread, but 30 // It's acceptable to construct the OneShotEvent on one thread, but
31 // immediately move it to another thread. 31 // immediately move it to another thread.
32 thread_checker_.DetachFromThread(); 32 thread_checker_.DetachFromThread();
(...skipping 28 matching lines...) Expand all
61 // single-threaded prevents that from being relevant. 61 // single-threaded prevents that from being relevant.
62 62
63 // We could randomize tasks_ in debug mode in order to check that 63 // We could randomize tasks_ in debug mode in order to check that
64 // the order doesn't matter... 64 // the order doesn't matter...
65 for (size_t i = 0; i < tasks_.size(); ++i) { 65 for (size_t i = 0; i < tasks_.size(); ++i) {
66 tasks_[i].runner->PostTask(tasks_[i].from_here, tasks_[i].task); 66 tasks_[i].runner->PostTask(tasks_[i].from_here, tasks_[i].task);
67 } 67 }
68 } 68 }
69 69
70 } // namespace extensions 70 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/matcher/url_matcher_factory_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698