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

Side by Side Diff: cc/scoped_thread_proxy.cc

Issue 11344004: Remove WebKit::Platform dependencies from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix webkit_compositor_bindings_unittests Created 8 years, 1 month 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/scoped_thread_proxy.h ('k') | cc/single_thread_proxy.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/scoped_thread_proxy.h" 7 #include "cc/scoped_thread_proxy.h"
8 8
9 #include "base/bind.h"
10
9 namespace cc { 11 namespace cc {
10 12
11 ScopedThreadProxy::ScopedThreadProxy(Thread* targetThread) 13 ScopedThreadProxy::ScopedThreadProxy(cc::Thread* targetThread)
12 : m_targetThread(targetThread) 14 : m_targetThread(targetThread)
13 , m_shutdown(false) 15 , m_shutdown(false)
14 { 16 {
15 } 17 }
16 18
17 ScopedThreadProxy::~ScopedThreadProxy() 19 ScopedThreadProxy::~ScopedThreadProxy()
18 { 20 {
19 } 21 }
20 22
23 void ScopedThreadProxy::postTask(const tracked_objects::Location& location, base ::Closure cb)
24 {
25 m_targetThread->postTask(base::Bind(&ScopedThreadProxy::runTaskIfNotShutdown , this, cb));
21 } 26 }
27
28 void ScopedThreadProxy::shutdown()
29 {
30 DCHECK(m_targetThread->belongsToCurrentThread());
31 DCHECK(!m_shutdown);
32 m_shutdown = true;
33 }
34
35 void ScopedThreadProxy::runTaskIfNotShutdown(base::Closure cb)
36 {
37 // If our shutdown flag is set, it's possible that m_targetThread has alread y been destroyed so don't
38 // touch it.
39 if (m_shutdown) {
40 return;
41 }
42 DCHECK(m_targetThread->belongsToCurrentThread());
43 cb.Run();
44 }
45
46 }
OLDNEW
« no previous file with comments | « cc/scoped_thread_proxy.h ('k') | cc/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698