OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "webkit/glue/plugins/test/plugin_npobject_lifetime_test.h" | 5 #include "webkit/glue/plugins/test/plugin_npobject_lifetime_test.h" |
6 | 6 |
7 namespace NPAPIClient { | 7 namespace NPAPIClient { |
8 | 8 |
9 const int kNPObjectLifetimeTimer = 100; | 9 const int kNPObjectLifetimeTimer = 100; |
10 const int kNPObjectLifetimeTimerElapse = 2000; | 10 const int kNPObjectLifetimeTimerElapse = 2000; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 | 107 |
108 NPObjectDeletePluginInNPN_Evaluate::~NPObjectDeletePluginInNPN_Evaluate() { | 108 NPObjectDeletePluginInNPN_Evaluate::~NPObjectDeletePluginInNPN_Evaluate() { |
109 if (plugin_instance_object_) { | 109 if (plugin_instance_object_) { |
110 HostFunctions()->releaseobject(plugin_instance_object_); | 110 HostFunctions()->releaseobject(plugin_instance_object_); |
111 plugin_instance_object_ = NULL; | 111 plugin_instance_object_ = NULL; |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 NPError NPObjectDeletePluginInNPN_Evaluate::SetWindow(NPWindow* np_window) { | 115 NPError NPObjectDeletePluginInNPN_Evaluate::SetWindow(NPWindow* np_window) { |
116 if (!::IsWindowVisible(reinterpret_cast<HWND>(np_window->window))) | |
117 return NPERR_NO_ERROR; | |
118 | |
119 HWND window_handle = reinterpret_cast<HWND>(np_window->window); | 116 HWND window_handle = reinterpret_cast<HWND>(np_window->window); |
120 // We setup a timerproc to invoke NPN_Evaluate to destroy this plugin | 117 // We setup a timerproc to invoke NPN_Evaluate to destroy this plugin |
121 // instance. This is to ensure that we don't destroy the plugin instance | 118 // instance. This is to ensure that we don't destroy the plugin instance |
122 // while it is being used in webkit as this leads to crashes and is a | 119 // while it is being used in webkit as this leads to crashes and is a |
123 // more accurate representation of the renderer crash as described in | 120 // more accurate representation of the renderer crash as described in |
124 // http://b/issue?id=1134683. | 121 // http://b/issue?id=1134683. |
125 if (!npn_evaluate_timer_proc_set_) { | 122 if (!npn_evaluate_timer_proc_set_) { |
126 npn_evaluate_timer_proc_set_ = true; | 123 npn_evaluate_timer_proc_set_ = true; |
127 SetTimer(window_handle, kNPObjectLifetimeTimer, kNPObjectLifetimeTimerElapse
, | 124 SetTimer(window_handle, kNPObjectLifetimeTimer, kNPObjectLifetimeTimerElapse
, |
128 TimerProc); | 125 TimerProc); |
(...skipping 27 matching lines...) Expand all Loading... |
156 | 153 |
157 NPVariant result_var; | 154 NPVariant result_var; |
158 NPError result = g_npn_evaluate_test_instance_->HostFunctions()->evaluate( | 155 NPError result = g_npn_evaluate_test_instance_->HostFunctions()->evaluate( |
159 g_npn_evaluate_test_instance_->id(), window_obj, | 156 g_npn_evaluate_test_instance_->id(), window_obj, |
160 &script_string, &result_var); | 157 &script_string, &result_var); |
161 // If this test failed we would have crashed by now. | 158 // If this test failed we would have crashed by now. |
162 } | 159 } |
163 | 160 |
164 } // namespace NPAPIClient | 161 } // namespace NPAPIClient |
165 | 162 |
OLD | NEW |