OLD | NEW |
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 // A class that receives IPC messages from an NPObjectProxy and calls the real | 5 // A class that receives IPC messages from an NPObjectProxy and calls the real |
6 // NPObject. | 6 // NPObject. |
7 | 7 |
8 #ifndef CONTENT_PLUGIN_NPOBJECT_STUB_H_ | 8 #ifndef CONTENT_PLUGIN_NPOBJECT_STUB_H_ |
9 #define CONTENT_PLUGIN_NPOBJECT_STUB_H_ | 9 #define CONTENT_PLUGIN_NPOBJECT_STUB_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 20 matching lines...) Expand all Loading... |
31 public base::SupportsWeakPtr<NPObjectStub>, | 31 public base::SupportsWeakPtr<NPObjectStub>, |
32 public NPObjectBase { | 32 public NPObjectBase { |
33 public: | 33 public: |
34 NPObjectStub(NPObject* npobject, | 34 NPObjectStub(NPObject* npobject, |
35 PluginChannelBase* channel, | 35 PluginChannelBase* channel, |
36 int route_id, | 36 int route_id, |
37 gfx::NativeViewId containing_window, | 37 gfx::NativeViewId containing_window, |
38 const GURL& page_url); | 38 const GURL& page_url); |
39 virtual ~NPObjectStub(); | 39 virtual ~NPObjectStub(); |
40 | 40 |
41 // Cause the stub to ignore any further IPC messages, and to tear itself down | 41 // Schedules tear-down of this stub. The underlying NPObject reference is |
42 // the next time control returns to the message loop. | 42 // released, and further invokations form the IPC channel will fail once this |
43 // The NPObject will be released only if |release_npobject| is true. | 43 // call has returned. Deletion of the stub is deferred to the main loop, in |
44 // This is used for the window script object stub in the renderer, which is | 44 // case it is touched as the stack unwinds. |
45 // freed with NPN_DeallocateObject to avoid leaks, and so we must not try to | 45 void DeleteSoon(); |
46 // release it. | |
47 void DeleteSoon(bool release_npobject); | |
48 | 46 |
49 // IPC::Message::Sender implementation: | 47 // IPC::Message::Sender implementation: |
50 virtual bool Send(IPC::Message* msg); | 48 virtual bool Send(IPC::Message* msg); |
51 | 49 |
52 // NPObjectBase implementation. | 50 // NPObjectBase implementation. |
53 virtual NPObject* GetUnderlyingNPObject(); | 51 virtual NPObject* GetUnderlyingNPObject(); |
54 virtual IPC::Channel::Listener* GetChannelListener(); | 52 virtual IPC::Channel::Listener* GetChannelListener(); |
55 | 53 |
56 private: | 54 private: |
57 // IPC::Channel::Listener implementation: | 55 // IPC::Channel::Listener implementation: |
(...skipping 30 matching lines...) Expand all Loading... |
88 NPObject* npobject_; | 86 NPObject* npobject_; |
89 scoped_refptr<PluginChannelBase> channel_; | 87 scoped_refptr<PluginChannelBase> channel_; |
90 int route_id_; | 88 int route_id_; |
91 gfx::NativeViewId containing_window_; | 89 gfx::NativeViewId containing_window_; |
92 | 90 |
93 // The url of the main frame hosting the plugin. | 91 // The url of the main frame hosting the plugin. |
94 GURL page_url_; | 92 GURL page_url_; |
95 }; | 93 }; |
96 | 94 |
97 #endif // CONTENT_PLUGIN_NPOBJECT_STUB_H_ | 95 #endif // CONTENT_PLUGIN_NPOBJECT_STUB_H_ |
OLD | NEW |