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

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

Issue 1174543002: ppapi: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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_PPB_MESSAGE_LOOP_PROXY_H_ 5 #ifndef PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_
6 #define PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ 6 #define PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/single_thread_task_runner.h"
13 #include "ppapi/proxy/interface_proxy.h" 14 #include "ppapi/proxy/interface_proxy.h"
14 #include "ppapi/proxy/ppapi_proxy_export.h" 15 #include "ppapi/proxy/ppapi_proxy_export.h"
15 #include "ppapi/shared_impl/ppb_message_loop_shared.h" 16 #include "ppapi/shared_impl/ppb_message_loop_shared.h"
16 #include "ppapi/thunk/ppb_message_loop_api.h" 17 #include "ppapi/thunk/ppb_message_loop_api.h"
17 18
18 struct PPB_MessageLoop_1_0; 19 struct PPB_MessageLoop_1_0;
19 20
20 namespace ppapi { 21 namespace ppapi {
21 namespace proxy { 22 namespace proxy {
22 23
(...skipping 13 matching lines...) Expand all
36 int32_t Run() override; 37 int32_t Run() override;
37 int32_t PostWork(PP_CompletionCallback callback, int64_t delay_ms) override; 38 int32_t PostWork(PP_CompletionCallback callback, int64_t delay_ms) override;
38 int32_t PostQuit(PP_Bool should_destroy) override; 39 int32_t PostQuit(PP_Bool should_destroy) override;
39 40
40 static MessageLoopResource* GetCurrent(); 41 static MessageLoopResource* GetCurrent();
41 void DetachFromThread(); 42 void DetachFromThread();
42 bool is_main_thread_loop() const { 43 bool is_main_thread_loop() const {
43 return is_main_thread_loop_; 44 return is_main_thread_loop_;
44 } 45 }
45 46
46 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy() { 47 const scoped_refptr<base::SingleThreadTaskRunner>& message_loop_proxy() {
bbudge 2015/06/10 20:57:46 Method name 'message_loop_proxy' is now misleading
Sami 2015/06/11 18:03:46 Agreed, let me try renaming it and seeing what bre
47 return loop_proxy_; 48 return task_runner_;
48 } 49 }
49 50
50 void set_currently_handling_blocking_message(bool handling_blocking_message) { 51 void set_currently_handling_blocking_message(bool handling_blocking_message) {
51 currently_handling_blocking_message_ = handling_blocking_message; 52 currently_handling_blocking_message_ = handling_blocking_message;
52 } 53 }
53 54
54 private: 55 private:
55 struct TaskInfo { 56 struct TaskInfo {
56 tracked_objects::Location from_here; 57 tracked_objects::Location from_here;
57 base::Closure closure; 58 base::Closure closure;
58 int64 delay_ms; 59 int64 delay_ms;
59 }; 60 };
60 61
61 // Returns true if the object is associated with the current thread. 62 // Returns true if the object is associated with the current thread.
62 bool IsCurrent() const; 63 bool IsCurrent() const;
63 64
64 // MessageLoopShared implementation. 65 // MessageLoopShared implementation.
65 // 66 //
66 // Handles posting to the message loop if there is one, or the pending queue 67 // Handles posting to the message loop if there is one, or the pending queue
67 // if there isn't. 68 // if there isn't.
68 // NOTE: The given closure will be run *WITHOUT* acquiring the Proxy lock. 69 // NOTE: The given closure will be run *WITHOUT* acquiring the Proxy lock.
69 // This only makes sense for user code and completely thread-safe 70 // This only makes sense for user code and completely thread-safe
70 // proxy operations (e.g., MessageLoop::QuitClosure). 71 // proxy operations (e.g., MessageLoop::QuitClosure).
71 void PostClosure(const tracked_objects::Location& from_here, 72 void PostClosure(const tracked_objects::Location& from_here,
72 const base::Closure& closure, 73 const base::Closure& closure,
73 int64 delay_ms) override; 74 int64 delay_ms) override;
74 base::MessageLoopProxy* GetMessageLoopProxy() override; 75 base::SingleThreadTaskRunner* GetMessageLoopProxy() override;
75 bool CurrentlyHandlingBlockingMessage() override; 76 bool CurrentlyHandlingBlockingMessage() override;
76 77
77 // TLS destructor function. 78 // TLS destructor function.
78 static void ReleaseMessageLoop(void* value); 79 static void ReleaseMessageLoop(void* value);
79 80
80 // Created when we attach to the current thread, since MessageLoop assumes 81 // Created when we attach to the current thread, since MessageLoop assumes
81 // that it's created on the thread it will run on. NULL for the main thread 82 // that it's created on the thread it will run on. NULL for the main thread
82 // loop, since that's owned by somebody else. This is needed for Run and Quit. 83 // loop, since that's owned by somebody else. This is needed for Run and Quit.
83 // Any time we post tasks, we should post them using loop_proxy_. 84 // Any time we post tasks, we should post them using task_runner_.
84 scoped_ptr<base::MessageLoop> loop_; 85 scoped_ptr<base::MessageLoop> loop_;
85 scoped_refptr<base::MessageLoopProxy> loop_proxy_; 86 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
86 87
87 // Number of invocations of Run currently on the stack. 88 // Number of invocations of Run currently on the stack.
88 int nested_invocations_; 89 int nested_invocations_;
89 90
90 // Set to true when the message loop is destroyed to prevent forther 91 // Set to true when the message loop is destroyed to prevent forther
91 // posting of work. 92 // posting of work.
92 bool destroyed_; 93 bool destroyed_;
93 94
94 // Set to true if all message loop invocations should exit and that the 95 // Set to true if all message loop invocations should exit and that the
95 // loop should be destroyed once it reaches the outermost Run invocation. 96 // loop should be destroyed once it reaches the outermost Run invocation.
(...skipping 19 matching lines...) Expand all
115 static const PPB_MessageLoop_1_0* GetInterface(); 116 static const PPB_MessageLoop_1_0* GetInterface();
116 117
117 private: 118 private:
118 DISALLOW_COPY_AND_ASSIGN(PPB_MessageLoop_Proxy); 119 DISALLOW_COPY_AND_ASSIGN(PPB_MessageLoop_Proxy);
119 }; 120 };
120 121
121 } // namespace proxy 122 } // namespace proxy
122 } // namespace ppapi 123 } // namespace ppapi
123 124
124 #endif // PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ 125 #endif // PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698