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

Side by Side Diff: ppapi/proxy/proxy_completion_callback_factory.h

Issue 14273043: ppapi: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 years, 7 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 | « ppapi/proxy/ppb_var_deprecated_proxy.cc ('k') | ppapi/shared_impl/resource_tracker.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 #ifndef PPAPI_PROXY_PROXY_COMPLETION_CALLBACK_FACTORY_H_ 5 #ifndef PPAPI_PROXY_PROXY_COMPLETION_CALLBACK_FACTORY_H_
6 #define PPAPI_PROXY_PROXY_COMPLETION_CALLBACK_FACTORY_H_ 6 #define PPAPI_PROXY_PROXY_COMPLETION_CALLBACK_FACTORY_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "ppapi/cpp/completion_callback.h" 10 #include "ppapi/cpp/completion_callback.h"
11 #include "ppapi/utility/completion_callback_factory.h" 11 #include "ppapi/utility/completion_callback_factory.h"
12 12
13 namespace ppapi { 13 namespace ppapi {
14 namespace proxy { 14 namespace proxy {
15 15
16 // This class is just like pp::NonThreadSafeThreadTraits but rather than using 16 // This class is just like pp::NonThreadSafeThreadTraits but rather than using
17 // pp::Module::core (which doesn't exist), it uses Chrome threads which do. 17 // pp::Module::core (which doesn't exist), it uses Chrome threads which do.
18 class ProxyNonThreadSafeThreadTraits { 18 class ProxyNonThreadSafeThreadTraits {
19 public: 19 public:
20 class RefCount { 20 class RefCount {
21 public: 21 public:
22 RefCount() : ref_(0) { 22 RefCount() : ref_(0) {
23 #ifndef NDEBUG 23 #ifndef NDEBUG
24 message_loop_ = MessageLoop::current(); 24 message_loop_ = base::MessageLoop::current();
25 #endif 25 #endif
26 } 26 }
27 27
28 ~RefCount() { 28 ~RefCount() {
29 #ifndef NDEBUG 29 #ifndef NDEBUG
30 DCHECK(message_loop_ == MessageLoop::current()); 30 DCHECK(message_loop_ == base::MessageLoop::current());
31 #endif 31 #endif
32 } 32 }
33 33
34 int32_t AddRef() { 34 int32_t AddRef() {
35 #ifndef NDEBUG 35 #ifndef NDEBUG
36 DCHECK(message_loop_ == MessageLoop::current()); 36 DCHECK(message_loop_ == base::MessageLoop::current());
37 #endif 37 #endif
38 return ++ref_; 38 return ++ref_;
39 } 39 }
40 40
41 int32_t Release() { 41 int32_t Release() {
42 #ifndef NDEBUG 42 #ifndef NDEBUG
43 DCHECK(message_loop_ == MessageLoop::current()); 43 DCHECK(message_loop_ == base::MessageLoop::current());
44 #endif 44 #endif
45 DCHECK(ref_ > 0); 45 DCHECK(ref_ > 0);
46 return --ref_; 46 return --ref_;
47 } 47 }
48 48
49 private: 49 private:
50 int32_t ref_; 50 int32_t ref_;
51 #ifndef NDEBUG 51 #ifndef NDEBUG
52 MessageLoop* message_loop_; 52 base::MessageLoop* message_loop_;
53 #endif 53 #endif
54 }; 54 };
55 55
56 // No-op lock class. 56 // No-op lock class.
57 class Lock { 57 class Lock {
58 public: 58 public:
59 Lock() {} 59 Lock() {}
60 ~Lock() {} 60 ~Lock() {}
61 61
62 void Acquire() {} 62 void Acquire() {}
(...skipping 15 matching lines...) Expand all
78 ProxyCompletionCallbackFactory() 78 ProxyCompletionCallbackFactory()
79 : pp::CompletionCallbackFactory<T, ProxyNonThreadSafeThreadTraits>() {} 79 : pp::CompletionCallbackFactory<T, ProxyNonThreadSafeThreadTraits>() {}
80 ProxyCompletionCallbackFactory(T* t) 80 ProxyCompletionCallbackFactory(T* t)
81 : pp::CompletionCallbackFactory<T, ProxyNonThreadSafeThreadTraits>(t) {} 81 : pp::CompletionCallbackFactory<T, ProxyNonThreadSafeThreadTraits>(t) {}
82 }; 82 };
83 83
84 } // namespace proxy 84 } // namespace proxy
85 } // namespace ppapi 85 } // namespace ppapi
86 86
87 #endif // PPAPI_PROXY_PROXY_COMPLETION_CALLBACK_FACTORY_H_ 87 #endif // PPAPI_PROXY_PROXY_COMPLETION_CALLBACK_FACTORY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_var_deprecated_proxy.cc ('k') | ppapi/shared_impl/resource_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698