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

Side by Side Diff: base/message_loop_proxy_impl.cc

Issue 9169037: Make new TaskRunner, SequencedTaskRunner, and SingleThreadTaskRunner interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win build Created 8 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
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 "base/message_loop_proxy_impl.h" 5 #include "base/message_loop_proxy_impl.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/threading/thread_restrictions.h" 8 #include "base/threading/thread_restrictions.h"
9 9
10 namespace base { 10 namespace base {
(...skipping 18 matching lines...) Expand all
29 return PostTaskHelper(from_here, task, 0, false); 29 return PostTaskHelper(from_here, task, 0, false);
30 } 30 }
31 31
32 bool MessageLoopProxyImpl::PostNonNestableDelayedTask( 32 bool MessageLoopProxyImpl::PostNonNestableDelayedTask(
33 const tracked_objects::Location& from_here, 33 const tracked_objects::Location& from_here,
34 const base::Closure& task, 34 const base::Closure& task,
35 int64 delay_ms) { 35 int64 delay_ms) {
36 return PostTaskHelper(from_here, task, delay_ms, false); 36 return PostTaskHelper(from_here, task, delay_ms, false);
37 } 37 }
38 38
39 bool MessageLoopProxyImpl::BelongsToCurrentThread() { 39 bool MessageLoopProxyImpl::MayRunTasksOnCurrentThread() const {
40 // We shouldn't use MessageLoop::current() since it uses LazyInstance which 40 // We shouldn't use MessageLoop::current() since it uses LazyInstance which
41 // may be deleted by ~AtExitManager when a WorkerPool thread calls this 41 // may be deleted by ~AtExitManager when a WorkerPool thread calls this
42 // function. 42 // function.
43 // http://crbug.com/63678 43 // http://crbug.com/63678
44 base::ThreadRestrictions::ScopedAllowSingleton allow_singleton; 44 base::ThreadRestrictions::ScopedAllowSingleton allow_singleton;
45 AutoLock lock(message_loop_lock_); 45 AutoLock lock(message_loop_lock_);
46 return (target_message_loop_ && 46 return (target_message_loop_ &&
47 (MessageLoop::current() == target_message_loop_)); 47 (MessageLoop::current() == target_message_loop_));
48 } 48 }
49 49
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 scoped_refptr<MessageLoopProxy> 95 scoped_refptr<MessageLoopProxy>
96 MessageLoopProxy::current() { 96 MessageLoopProxy::current() {
97 MessageLoop* cur_loop = MessageLoop::current(); 97 MessageLoop* cur_loop = MessageLoop::current();
98 if (!cur_loop) 98 if (!cur_loop)
99 return NULL; 99 return NULL;
100 return cur_loop->message_loop_proxy(); 100 return cur_loop->message_loop_proxy();
101 } 101 }
102 102
103 } // namespace base 103 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698