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 "ipc/ipc_message.h" | 7 #include "ipc/ipc_message.h" |
8 #include "ipc/ipc_sender.h" | 8 #include "ipc/ipc_sender.h" |
9 #include "ppapi/proxy/plugin_dispatcher.h" | 9 #include "ppapi/proxy/plugin_dispatcher.h" |
10 #include "ppapi/proxy/plugin_proxy_delegate.h" | 10 #include "ppapi/proxy/plugin_proxy_delegate.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 #if defined(ENABLE_PEPPER_THREADING) | 69 #if defined(ENABLE_PEPPER_THREADING) |
70 enable_threading_ = true; | 70 enable_threading_ = true; |
71 #else | 71 #else |
72 enable_threading_ = false; | 72 enable_threading_ = false; |
73 #endif | 73 #endif |
74 DCHECK(!plugin_globals_); | 74 DCHECK(!plugin_globals_); |
75 } | 75 } |
76 | 76 |
77 PluginGlobals::~PluginGlobals() { | 77 PluginGlobals::~PluginGlobals() { |
78 DCHECK(plugin_globals_ == this || !plugin_globals_); | 78 DCHECK(plugin_globals_ == this || !plugin_globals_); |
| 79 // Release the main-thread message loop. We should have the last reference |
| 80 // count, so this will delete the MessageLoop resource. We do this before |
| 81 // we clear plugin_globals_, because the Resource destructor tries to access |
| 82 // this PluginGlobals. |
| 83 DCHECK(!loop_for_main_thread_ || loop_for_main_thread_->HasOneRef()); |
| 84 loop_for_main_thread_ = NULL; |
| 85 |
79 plugin_globals_ = NULL; | 86 plugin_globals_ = NULL; |
80 } | 87 } |
81 | 88 |
82 ResourceTracker* PluginGlobals::GetResourceTracker() { | 89 ResourceTracker* PluginGlobals::GetResourceTracker() { |
83 return &plugin_resource_tracker_; | 90 return &plugin_resource_tracker_; |
84 } | 91 } |
85 | 92 |
86 VarTracker* PluginGlobals::GetVarTracker() { | 93 VarTracker* PluginGlobals::GetVarTracker() { |
87 return &plugin_var_tracker_; | 94 return &plugin_var_tracker_; |
88 } | 95 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 MessageLoopResource* PluginGlobals::loop_for_main_thread() { | 178 MessageLoopResource* PluginGlobals::loop_for_main_thread() { |
172 return loop_for_main_thread_.get(); | 179 return loop_for_main_thread_.get(); |
173 } | 180 } |
174 | 181 |
175 bool PluginGlobals::IsPluginGlobals() const { | 182 bool PluginGlobals::IsPluginGlobals() const { |
176 return true; | 183 return true; |
177 } | 184 } |
178 | 185 |
179 } // namespace proxy | 186 } // namespace proxy |
180 } // namespace ppapi | 187 } // namespace ppapi |
OLD | NEW |