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

Side by Side Diff: webkit/plugins/ppapi/ppb_proxy_impl.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 "webkit/plugins/ppapi/ppb_proxy_impl.h" 5 #include "webkit/plugins/ppapi/ppb_proxy_impl.h"
6 6
7 #include "ppapi/c/private/ppb_proxy_private.h" 7 #include "ppapi/c/private/ppb_proxy_private.h"
8 #include "webkit/plugins/ppapi/plugin_module.h" 8 #include "webkit/plugins/ppapi/plugin_module.h"
9 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 9 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
10 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" 10 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 int32_t GetURLLoaderBufferedBytes(PP_Resource url_loader) { 39 int32_t GetURLLoaderBufferedBytes(PP_Resource url_loader) {
40 scoped_refptr<PPB_URLLoader_Impl> loader( 40 scoped_refptr<PPB_URLLoader_Impl> loader(
41 Resource::GetAs<PPB_URLLoader_Impl>(url_loader)); 41 Resource::GetAs<PPB_URLLoader_Impl>(url_loader));
42 if (!loader) 42 if (!loader)
43 return 0; 43 return 0;
44 return loader->buffer_size(); 44 return loader->buffer_size();
45 } 45 }
46 46
47 void AddRefModule(PP_Module module) {
48 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module);
49 if (plugin_module)
50 plugin_module->AddRef();
51 }
52
53 void ReleaseModule(PP_Module module) {
54 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module);
55 if (plugin_module)
56 plugin_module->Release();
57 }
58
47 const PPB_Proxy_Private ppb_proxy = { 59 const PPB_Proxy_Private ppb_proxy = {
48 &PluginCrashed, 60 &PluginCrashed,
49 &GetInstanceForResource, 61 &GetInstanceForResource,
50 &SetReserveInstanceIDCallback, 62 &SetReserveInstanceIDCallback,
51 &GetURLLoaderBufferedBytes 63 &GetURLLoaderBufferedBytes,
64 &AddRefModule,
65 &ReleaseModule
52 }; 66 };
53 67
54 } // namespace 68 } // namespace
55 69
56 // static 70 // static
57 const PPB_Proxy_Private* PPB_Proxy_Impl::GetInterface() { 71 const PPB_Proxy_Private* PPB_Proxy_Impl::GetInterface() {
58 return &ppb_proxy; 72 return &ppb_proxy;
59 } 73 }
60 74
61 } // namespace ppapi 75 } // namespace ppapi
62 } // namespace webkit 76 } // namespace webkit
OLDNEW
« ppapi/tests/manual/delete_plugin.cc ('K') | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698