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