OLD | NEW |
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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/bind.h" | 12 #include "base/bind.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
15 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
16 #include "ppapi/proxy/interface_proxy.h" | 17 #include "ppapi/proxy/interface_proxy.h" |
17 #include "ppapi/proxy/ppapi_proxy_export.h" | 18 #include "ppapi/proxy/ppapi_proxy_export.h" |
18 #include "ppapi/shared_impl/ppb_message_loop_shared.h" | 19 #include "ppapi/shared_impl/ppb_message_loop_shared.h" |
19 #include "ppapi/thunk/ppb_message_loop_api.h" | 20 #include "ppapi/thunk/ppb_message_loop_api.h" |
20 | 21 |
21 struct PPB_MessageLoop_1_0; | 22 struct PPB_MessageLoop_1_0; |
22 | 23 |
23 namespace ppapi { | 24 namespace ppapi { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 base::SingleThreadTaskRunner* GetTaskRunner() override; | 78 base::SingleThreadTaskRunner* GetTaskRunner() override; |
78 bool CurrentlyHandlingBlockingMessage() override; | 79 bool CurrentlyHandlingBlockingMessage() override; |
79 | 80 |
80 // TLS destructor function. | 81 // TLS destructor function. |
81 static void ReleaseMessageLoop(void* value); | 82 static void ReleaseMessageLoop(void* value); |
82 | 83 |
83 // Created when we attach to the current thread, since MessageLoop assumes | 84 // Created when we attach to the current thread, since MessageLoop assumes |
84 // that it's created on the thread it will run on. NULL for the main thread | 85 // that it's created on the thread it will run on. NULL for the main thread |
85 // loop, since that's owned by somebody else. This is needed for Run and Quit. | 86 // loop, since that's owned by somebody else. This is needed for Run and Quit. |
86 // Any time we post tasks, we should post them using task_runner_. | 87 // Any time we post tasks, we should post them using task_runner_. |
87 scoped_ptr<base::MessageLoop> loop_; | 88 std::unique_ptr<base::MessageLoop> loop_; |
88 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 89 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
89 | 90 |
90 // Number of invocations of Run currently on the stack. | 91 // Number of invocations of Run currently on the stack. |
91 int nested_invocations_; | 92 int nested_invocations_; |
92 | 93 |
93 // Set to true when the message loop is destroyed to prevent forther | 94 // Set to true when the message loop is destroyed to prevent forther |
94 // posting of work. | 95 // posting of work. |
95 bool destroyed_; | 96 bool destroyed_; |
96 | 97 |
97 // Set to true if all message loop invocations should exit and that the | 98 // Set to true if all message loop invocations should exit and that the |
(...skipping 20 matching lines...) Expand all Loading... |
118 static const PPB_MessageLoop_1_0* GetInterface(); | 119 static const PPB_MessageLoop_1_0* GetInterface(); |
119 | 120 |
120 private: | 121 private: |
121 DISALLOW_COPY_AND_ASSIGN(PPB_MessageLoop_Proxy); | 122 DISALLOW_COPY_AND_ASSIGN(PPB_MessageLoop_Proxy); |
122 }; | 123 }; |
123 | 124 |
124 } // namespace proxy | 125 } // namespace proxy |
125 } // namespace ppapi | 126 } // namespace ppapi |
126 | 127 |
127 #endif // PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ | 128 #endif // PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ |
OLD | NEW |