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

Side by Side Diff: webkit/plugins/ppapi/message_channel.h

Issue 9655019: Fix a crash related to PPAPI scripting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 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 | « ppapi/proxy/var_serialization_rules.h ('k') | webkit/plugins/ppapi/message_channel.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
6 #define WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_ 6 #define WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "ppapi/shared_impl/resource.h" 9 #include "ppapi/shared_impl/resource.h"
10 #include "third_party/npapi/bindings/npruntime.h" 10 #include "third_party/npapi/bindings/npruntime.h"
11 11
(...skipping 23 matching lines...) Expand all
35 class MessageChannel { 35 class MessageChannel {
36 public: 36 public:
37 // MessageChannelNPObject is a simple struct that adds a pointer back to a 37 // MessageChannelNPObject is a simple struct that adds a pointer back to a
38 // MessageChannel instance. This way, we can use an NPObject to allow 38 // MessageChannel instance. This way, we can use an NPObject to allow
39 // JavaScript interactions without forcing MessageChannel to inherit from 39 // JavaScript interactions without forcing MessageChannel to inherit from
40 // NPObject. 40 // NPObject.
41 struct MessageChannelNPObject : public NPObject { 41 struct MessageChannelNPObject : public NPObject {
42 MessageChannelNPObject(); 42 MessageChannelNPObject();
43 ~MessageChannelNPObject(); 43 ~MessageChannelNPObject();
44 44
45 MessageChannel* message_channel; 45 base::WeakPtr<MessageChannel> message_channel;
46 }; 46 };
47 47
48 explicit MessageChannel(PluginInstance* instance); 48 explicit MessageChannel(PluginInstance* instance);
49 ~MessageChannel(); 49 ~MessageChannel();
50 50
51 // Post a message to the onmessage handler for this channel's instance 51 // Post a message to the onmessage handler for this channel's instance
52 // asynchronously. 52 // asynchronously.
53 void PostMessageToJavaScript(PP_Var message_data); 53 void PostMessageToJavaScript(PP_Var message_data);
54 // Post a message to the PPP_Instance HandleMessage function for this 54 // Post a message to the PPP_Instance HandleMessage function for this
55 // channel's instance. 55 // channel's instance.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // destroyed. 95 // destroyed.
96 base::WeakPtrFactory<MessageChannel> weak_ptr_factory_; 96 base::WeakPtrFactory<MessageChannel> weak_ptr_factory_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(MessageChannel); 98 DISALLOW_COPY_AND_ASSIGN(MessageChannel);
99 }; 99 };
100 100
101 } // namespace ppapi 101 } // namespace ppapi
102 } // namespace webkit 102 } // namespace webkit
103 103
104 #endif // WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_ 104 #endif // WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/var_serialization_rules.h ('k') | webkit/plugins/ppapi/message_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698