Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: webkit/plugins/npapi/test/plugin_npobject_lifetime_test.cc

Issue 12298002: Make npapi_test_plugin build on Win64 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/npapi/test/plugin_npobject_lifetime_test.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/plugins/npapi/test/plugin_npobject_lifetime_test.h" 5 #include "webkit/plugins/npapi/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 21 matching lines...) Expand all
32 // We attempt to retreive the NPObject for the plugin instance identified 32 // We attempt to retreive the NPObject for the plugin instance identified
33 // by the NPObjectLifetimeTestInstance2 class as it may not have been 33 // by the NPObjectLifetimeTestInstance2 class as it may not have been
34 // instantiated yet. 34 // instantiated yet.
35 timer_id_ = SetTimer(window_handle, kNPObjectLifetimeTimer, 35 timer_id_ = SetTimer(window_handle, kNPObjectLifetimeTimer,
36 kNPObjectLifetimeTimerElapse, TimerProc); 36 kNPObjectLifetimeTimerElapse, TimerProc);
37 } 37 }
38 return NPERR_NO_ERROR; 38 return NPERR_NO_ERROR;
39 } 39 }
40 40
41 void CALLBACK NPObjectLifetimeTest::TimerProc( 41 void CALLBACK NPObjectLifetimeTest::TimerProc(
42 HWND window, UINT message, UINT timer_id, 42 HWND window, UINT message, UINT_PTR timer_id,
43 unsigned long elapsed_milli_seconds) { 43 DWORD elapsed_milli_seconds) {
44 44
45 NPObjectLifetimeTest* this_instance = 45 NPObjectLifetimeTest* this_instance =
46 reinterpret_cast<NPObjectLifetimeTest*> 46 reinterpret_cast<NPObjectLifetimeTest*>
47 (::GetProp(window, L"Plugin_Instance")); 47 (::GetProp(window, L"Plugin_Instance"));
48 KillTimer(window, this_instance->timer_id_); 48 KillTimer(window, this_instance->timer_id_);
49 ::RemoveProp(window, L"Plugin_Instance"); 49 ::RemoveProp(window, L"Plugin_Instance");
50 50
51 this_instance->timer_id_ = 0; 51 this_instance->timer_id_ = 0;
52 52
53 this_instance->other_plugin_instance_object_ = 53 this_instance->other_plugin_instance_object_ =
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return NPERR_NO_ERROR; 128 return NPERR_NO_ERROR;
129 129
130 HWND window_handle = reinterpret_cast<HWND>(np_window->window); 130 HWND window_handle = reinterpret_cast<HWND>(np_window->window);
131 // We setup a timerproc to invoke NPN_Evaluate to destroy this plugin 131 // We setup a timerproc to invoke NPN_Evaluate to destroy this plugin
132 // instance. This is to ensure that we don't destroy the plugin instance 132 // instance. This is to ensure that we don't destroy the plugin instance
133 // while it is being used in webkit as this leads to crashes and is a 133 // while it is being used in webkit as this leads to crashes and is a
134 // more accurate representation of the renderer crash as described in 134 // more accurate representation of the renderer crash as described in
135 // http://b/issue?id=1134683. 135 // http://b/issue?id=1134683.
136 if (!timer_id_) { 136 if (!timer_id_) {
137 timer_id_ = SetTimer(window_handle, kNPObjectLifetimeTimer, 137 timer_id_ = SetTimer(window_handle, kNPObjectLifetimeTimer,
138 kNPObjectLifetimeTimerElapse, TimerProc); 138 kNPObjectLifetimeTimerElapse, TimerProc);
139 } 139 }
140 return NPERR_NO_ERROR; 140 return NPERR_NO_ERROR;
141 } 141 }
142 142
143 void CALLBACK NPObjectDeletePluginInNPN_Evaluate::TimerProc( 143 void CALLBACK NPObjectDeletePluginInNPN_Evaluate::TimerProc(
144 HWND window, UINT message, UINT timer_id, 144 HWND window, UINT message, UINT_PTR timer_id,
145 unsigned long elapsed_milli_seconds) { 145 DWORD elapsed_milli_seconds) {
146 146
147 KillTimer(window, g_npn_evaluate_test_instance_->timer_id_); 147 KillTimer(window, g_npn_evaluate_test_instance_->timer_id_);
148 g_npn_evaluate_test_instance_->timer_id_ = 0; 148 g_npn_evaluate_test_instance_->timer_id_ = 0;
149 NPObject *window_obj = NULL; 149 NPObject *window_obj = NULL;
150 g_npn_evaluate_test_instance_->HostFunctions()->getvalue( 150 g_npn_evaluate_test_instance_->HostFunctions()->getvalue(
151 g_npn_evaluate_test_instance_->id(), NPNVWindowNPObject, 151 g_npn_evaluate_test_instance_->id(), NPNVWindowNPObject,
152 &window_obj); 152 &window_obj);
153 153
154 if (!window_obj) { 154 if (!window_obj) {
155 g_npn_evaluate_test_instance_->SetError( 155 g_npn_evaluate_test_instance_->SetError(
156 "Failed to get NPObject for plugin instance2"); 156 "Failed to get NPObject for plugin instance2");
157 g_npn_evaluate_test_instance_->SignalTestCompleted(); 157 g_npn_evaluate_test_instance_->SignalTestCompleted();
158 return; 158 return;
159 } 159 }
160 160
161 std::string script = "javascript:DeletePluginWithinScript()"; 161 std::string script = "javascript:DeletePluginWithinScript()";
162 NPString script_string; 162 NPString script_string;
163 script_string.UTF8Characters = script.c_str(); 163 script_string.UTF8Characters = script.c_str();
164 script_string.UTF8Length = 164 script_string.UTF8Length =
165 static_cast<unsigned int>(script.length()); 165 static_cast<unsigned int>(script.length());
166 166
167 NPVariant result_var; 167 NPVariant result_var;
168 bool result = g_npn_evaluate_test_instance_->HostFunctions()->evaluate( 168 bool result = g_npn_evaluate_test_instance_->HostFunctions()->evaluate(
169 g_npn_evaluate_test_instance_->id(), window_obj, 169 g_npn_evaluate_test_instance_->id(), window_obj,
170 &script_string, &result_var); 170 &script_string, &result_var);
171 // If this test failed we would have crashed by now. 171 // If this test failed we would have crashed by now.
172 } 172 }
173 173
174 } // namespace NPAPIClient 174 } // namespace NPAPIClient
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/test/plugin_npobject_lifetime_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698