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 #include "ppapi/proxy/plugin_globals.h" | 5 #include "ppapi/proxy/plugin_globals.h" |
6 | 6 |
7 #include "ppapi/proxy/plugin_dispatcher.h" | 7 #include "ppapi/proxy/plugin_dispatcher.h" |
8 #include "ppapi/proxy/plugin_proxy_delegate.h" | 8 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 9 #include "ppapi/proxy/ppb_message_loop_proxy.h" |
9 #include "ppapi/thunk/enter.h" | 10 #include "ppapi/thunk/enter.h" |
10 | 11 |
11 namespace ppapi { | 12 namespace ppapi { |
12 namespace proxy { | 13 namespace proxy { |
13 | 14 |
14 PluginGlobals* PluginGlobals::plugin_globals_ = NULL; | 15 PluginGlobals* PluginGlobals::plugin_globals_ = NULL; |
15 | 16 |
16 PluginGlobals::PluginGlobals() | 17 PluginGlobals::PluginGlobals() |
17 : ppapi::PpapiGlobals(), | 18 : ppapi::PpapiGlobals(), |
18 plugin_proxy_delegate_(NULL), | 19 plugin_proxy_delegate_(NULL), |
19 callback_tracker_(new CallbackTracker) { | 20 callback_tracker_(new CallbackTracker), |
| 21 loop_for_main_thread_( |
| 22 new MessageLoopResource(MessageLoopResource::ForMainThread())) { |
20 DCHECK(!plugin_globals_); | 23 DCHECK(!plugin_globals_); |
21 plugin_globals_ = this; | 24 plugin_globals_ = this; |
22 } | 25 } |
23 | 26 |
24 PluginGlobals::PluginGlobals(ForTest for_test) | 27 PluginGlobals::PluginGlobals(ForTest for_test) |
25 : ppapi::PpapiGlobals(for_test), | 28 : ppapi::PpapiGlobals(for_test), |
26 plugin_proxy_delegate_(NULL), | 29 plugin_proxy_delegate_(NULL), |
27 callback_tracker_(new CallbackTracker) { | 30 callback_tracker_(new CallbackTracker) { |
28 DCHECK(!plugin_globals_); | 31 DCHECK(!plugin_globals_); |
29 } | 32 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void PluginGlobals::BroadcastLogWithSource(PP_Module /* module */, | 98 void PluginGlobals::BroadcastLogWithSource(PP_Module /* module */, |
96 PP_LogLevel_Dev level, | 99 PP_LogLevel_Dev level, |
97 const std::string& source, | 100 const std::string& source, |
98 const std::string& value) { | 101 const std::string& value) { |
99 // Since we have only one module in a plugin process, broadcast is always | 102 // Since we have only one module in a plugin process, broadcast is always |
100 // the same as "send to everybody" which is what the dispatcher implements | 103 // the same as "send to everybody" which is what the dispatcher implements |
101 // for the "instance = 0" case. | 104 // for the "instance = 0" case. |
102 LogWithSource(0, level, source, value); | 105 LogWithSource(0, level, source, value); |
103 } | 106 } |
104 | 107 |
| 108 MessageLoopResource* PluginGlobals::loop_for_main_thread() { |
| 109 return loop_for_main_thread_.get(); |
| 110 } |
| 111 |
105 bool PluginGlobals::IsPluginGlobals() const { | 112 bool PluginGlobals::IsPluginGlobals() const { |
106 return true; | 113 return true; |
107 } | 114 } |
108 | 115 |
109 } // namespace proxy | 116 } // namespace proxy |
110 } // namespace ppapi | 117 } // namespace ppapi |
OLD | NEW |