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

Side by Side Diff: chrome/plugin/npobject_util.cc

Issue 155238: Add the page url to plugin crashes to aid debugging. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | « chrome/plugin/npobject_util.h ('k') | chrome/plugin/webplugin_delegate_stub.h » ('j') | 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) 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 "chrome/plugin/npobject_util.h" 5 #include "chrome/plugin/npobject_util.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/common/plugin_messages.h" 8 #include "chrome/common/plugin_messages.h"
9 #include "chrome/plugin/npobject_proxy.h" 9 #include "chrome/plugin/npobject_proxy.h"
10 #include "chrome/plugin/plugin_channel_base.h" 10 #include "chrome/plugin/plugin_channel_base.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 132
133 NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param) { 133 NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param) {
134 return param.identifier; 134 return param.identifier;
135 } 135 }
136 136
137 void CreateNPVariantParam(const NPVariant& variant, 137 void CreateNPVariantParam(const NPVariant& variant,
138 PluginChannelBase* channel, 138 PluginChannelBase* channel,
139 NPVariant_Param* param, 139 NPVariant_Param* param,
140 bool release, 140 bool release,
141 base::WaitableEvent* modal_dialog_event) { 141 base::WaitableEvent* modal_dialog_event,
142 const GURL& page_url) {
142 switch (variant.type) { 143 switch (variant.type) {
143 case NPVariantType_Void: 144 case NPVariantType_Void:
144 param->type = NPVARIANT_PARAM_VOID; 145 param->type = NPVARIANT_PARAM_VOID;
145 break; 146 break;
146 case NPVariantType_Null: 147 case NPVariantType_Null:
147 param->type = NPVARIANT_PARAM_NULL; 148 param->type = NPVARIANT_PARAM_NULL;
148 break; 149 break;
149 case NPVariantType_Bool: 150 case NPVariantType_Bool:
150 param->type = NPVARIANT_PARAM_BOOL; 151 param->type = NPVARIANT_PARAM_BOOL;
151 param->bool_value = variant.value.boolValue; 152 param->bool_value = variant.value.boolValue;
(...skipping 24 matching lines...) Expand all
176 } else { 177 } else {
177 // The channel could be NULL if there was a channel error. The caller's 178 // The channel could be NULL if there was a channel error. The caller's
178 // Send call will fail anyways. 179 // Send call will fail anyways.
179 if (channel) { 180 if (channel) {
180 // NPObjectStub adds its own reference to the NPObject it owns, so if 181 // NPObjectStub adds its own reference to the NPObject it owns, so if
181 // we were supposed to release the corresponding variant 182 // we were supposed to release the corresponding variant
182 // (release==true), we should still do that. 183 // (release==true), we should still do that.
183 param->type = NPVARIANT_PARAM_OBJECT_ROUTING_ID; 184 param->type = NPVARIANT_PARAM_OBJECT_ROUTING_ID;
184 int route_id = channel->GenerateRouteID(); 185 int route_id = channel->GenerateRouteID();
185 new NPObjectStub( 186 new NPObjectStub(
186 variant.value.objectValue, channel, route_id, modal_dialog_event); 187 variant.value.objectValue, channel, route_id, modal_dialog_event,
188 page_url);
187 param->npobject_routing_id = route_id; 189 param->npobject_routing_id = route_id;
188 param->npobject_pointer = 190 param->npobject_pointer =
189 reinterpret_cast<intptr_t>(variant.value.objectValue); 191 reinterpret_cast<intptr_t>(variant.value.objectValue);
190 } else { 192 } else {
191 param->type = NPVARIANT_PARAM_VOID; 193 param->type = NPVARIANT_PARAM_VOID;
192 } 194 }
193 } 195 }
194 break; 196 break;
195 } 197 }
196 default: 198 default:
197 NOTREACHED(); 199 NOTREACHED();
198 } 200 }
199 201
200 if (release) 202 if (release)
201 NPN_ReleaseVariantValue(const_cast<NPVariant*>(&variant)); 203 NPN_ReleaseVariantValue(const_cast<NPVariant*>(&variant));
202 } 204 }
203 205
204 void CreateNPVariant(const NPVariant_Param& param, 206 void CreateNPVariant(const NPVariant_Param& param,
205 PluginChannelBase* channel, 207 PluginChannelBase* channel,
206 NPVariant* result, 208 NPVariant* result,
207 base::WaitableEvent* modal_dialog_event) { 209 base::WaitableEvent* modal_dialog_event,
210 const GURL& page_url) {
208 switch (param.type) { 211 switch (param.type) {
209 case NPVARIANT_PARAM_VOID: 212 case NPVARIANT_PARAM_VOID:
210 result->type = NPVariantType_Void; 213 result->type = NPVariantType_Void;
211 break; 214 break;
212 case NPVARIANT_PARAM_NULL: 215 case NPVARIANT_PARAM_NULL:
213 result->type = NPVariantType_Null; 216 result->type = NPVariantType_Null;
214 break; 217 break;
215 case NPVARIANT_PARAM_BOOL: 218 case NPVARIANT_PARAM_BOOL:
216 result->type = NPVariantType_Bool; 219 result->type = NPVariantType_Bool;
217 result->value.boolValue = param.bool_value; 220 result->value.boolValue = param.bool_value;
(...skipping 12 matching lines...) Expand all
230 static_cast<NPUTF8 *>(base::strdup(param.string_value.c_str())); 233 static_cast<NPUTF8 *>(base::strdup(param.string_value.c_str()));
231 result->value.stringValue.UTF8Length = 234 result->value.stringValue.UTF8Length =
232 static_cast<int>(param.string_value.size()); 235 static_cast<int>(param.string_value.size());
233 break; 236 break;
234 case NPVARIANT_PARAM_OBJECT_ROUTING_ID: 237 case NPVARIANT_PARAM_OBJECT_ROUTING_ID:
235 result->type = NPVariantType_Object; 238 result->type = NPVariantType_Object;
236 result->value.objectValue = 239 result->value.objectValue =
237 NPObjectProxy::Create(channel, 240 NPObjectProxy::Create(channel,
238 param.npobject_routing_id, 241 param.npobject_routing_id,
239 param.npobject_pointer, 242 param.npobject_pointer,
240 modal_dialog_event); 243 modal_dialog_event,
244 page_url);
241 break; 245 break;
242 case NPVARIANT_PARAM_OBJECT_POINTER: 246 case NPVARIANT_PARAM_OBJECT_POINTER:
243 result->type = NPVariantType_Object; 247 result->type = NPVariantType_Object;
244 result->value.objectValue = 248 result->value.objectValue =
245 reinterpret_cast<NPObject*>(param.npobject_pointer); 249 reinterpret_cast<NPObject*>(param.npobject_pointer);
246 NPN_RetainObject(result->value.objectValue); 250 NPN_RetainObject(result->value.objectValue);
247 break; 251 break;
248 default: 252 default:
249 NOTREACHED(); 253 NOTREACHED();
250 } 254 }
251 } 255 }
OLDNEW
« no previous file with comments | « chrome/plugin/npobject_util.h ('k') | chrome/plugin/webplugin_delegate_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698