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

Side by Side Diff: ppapi/proxy/host_dispatcher.h

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 #ifndef PPAPI_PROXY_HOST_DISPATCHER_H_ 5 #ifndef PPAPI_PROXY_HOST_DISPATCHER_H_
6 #define PPAPI_PROXY_HOST_DISPATCHER_H_ 6 #define PPAPI_PROXY_HOST_DISPATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Set to true when the plugin is in a state that it can be reentered by a 114 // Set to true when the plugin is in a state that it can be reentered by a
115 // sync message from the host. We allow reentrancy only when we're processing 115 // sync message from the host. We allow reentrancy only when we're processing
116 // a sync message from the renderer that is a scripting command. When the 116 // a sync message from the renderer that is a scripting command. When the
117 // plugin is in this state, it needs to accept reentrancy since scripting may 117 // plugin is in this state, it needs to accept reentrancy since scripting may
118 // ultimately call back into the plugin. 118 // ultimately call back into the plugin.
119 bool allow_plugin_reentrancy_; 119 bool allow_plugin_reentrancy_;
120 120
121 DISALLOW_COPY_AND_ASSIGN(HostDispatcher); 121 DISALLOW_COPY_AND_ASSIGN(HostDispatcher);
122 }; 122 };
123 123
124 // Create this object on the stack to prevent the module (and hence the
125 // dispatcher) from being deleted out from under you. This is necessary when
126 // calling some scripting functions that may delete the plugin.
127 //
128 // This may only be called in the host. The parameter is a plain Dispatcher
129 // since that's what most callers have.
130 class ScopedModuleReference {
131 public:
132 ScopedModuleReference(Dispatcher* dispatcher);
133 ~ScopedModuleReference();
134
135 private:
136 HostDispatcher* dispatcher_;
137
138 DISALLOW_COPY_AND_ASSIGN(ScopedModuleReference);
139 };
140
124 } // namespace proxy 141 } // namespace proxy
125 } // namespace pp 142 } // namespace pp
126 143
127 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_ 144 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698