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

Side by Side Diff: ppapi/proxy/ppb_instance_proxy.cc

Issue 6881012: Keep the module in scope when executing scripts. This prevents a crash when the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ppb_instance_proxy.h" 5 #include "ppapi/proxy/ppb_instance_proxy.h"
6 6
7 #include "ppapi/c/pp_var.h" 7 #include "ppapi/c/pp_var.h"
8 #include "ppapi/c/ppb_instance.h" 8 #include "ppapi/c/ppb_instance.h"
9 #include "ppapi/proxy/host_dispatcher.h" 9 #include "ppapi/proxy/host_dispatcher.h"
10 #include "ppapi/proxy/plugin_dispatcher.h" 10 #include "ppapi/proxy/plugin_dispatcher.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 &instance_interface, 113 &instance_interface,
114 PPB_INSTANCE_INTERFACE, 114 PPB_INSTANCE_INTERFACE,
115 INTERFACE_ID_PPB_INSTANCE, 115 INTERFACE_ID_PPB_INSTANCE,
116 false, 116 false,
117 &CreateInstanceProxy, 117 &CreateInstanceProxy,
118 }; 118 };
119 return &info; 119 return &info;
120 } 120 }
121 121
122 bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { 122 bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
123 // Prevent the dispatcher from going away during a call to ExecuteScript.
124 // This must happen OUTSIDE of ExecuteScript since the SerializedVars use
125 // the dispatcher upon return of the function (converting the
126 // SerializedVarReturnValue/OutParam to a SerializedVar in the destructor).
127 ScopedModuleReference death_grip(dispatcher());
128
123 bool handled = true; 129 bool handled = true;
124 IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg) 130 IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg)
125 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject, 131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject,
126 OnMsgGetWindowObject) 132 OnMsgGetWindowObject)
127 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject, 133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject,
128 OnMsgGetOwnerElementObject) 134 OnMsgGetOwnerElementObject)
129 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics, 135 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics,
130 OnMsgBindGraphics) 136 OnMsgBindGraphics)
131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame, 137 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame,
132 OnMsgIsFullFrame) 138 OnMsgIsFullFrame)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy(); 180 static_cast<HostDispatcher*>(dispatcher())->set_allow_plugin_reentrancy();
175 181
176 result.Return(dispatcher(), ppb_instance_target()->ExecuteScript( 182 result.Return(dispatcher(), ppb_instance_target()->ExecuteScript(
177 instance, 183 instance,
178 script.Get(dispatcher()), 184 script.Get(dispatcher()),
179 out_exception.OutParam(dispatcher()))); 185 out_exception.OutParam(dispatcher())));
180 } 186 }
181 187
182 } // namespace proxy 188 } // namespace proxy
183 } // namespace pp 189 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698