OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/plugin/npobject_stub.h" | 5 #include "chrome/plugin/npobject_stub.h" |
6 | 6 |
7 #include "chrome/common/child_process_logging.h" | 7 #include "chrome/common/child_process_logging.h" |
8 #include "chrome/common/plugin_messages.h" | 8 #include "chrome/common/plugin_messages.h" |
9 #include "chrome/plugin/npobject_util.h" | 9 #include "chrome/plugin/npobject_util.h" |
10 #include "chrome/plugin/plugin_channel_base.h" | 10 #include "chrome/plugin/plugin_channel_base.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // We null out the underlying NPObject pointer since it's not valid anymore ( | 47 // We null out the underlying NPObject pointer since it's not valid anymore ( |
48 // ScriptController manually deleted the object). As a result, | 48 // ScriptController manually deleted the object). As a result, |
49 // OnMessageReceived won't dispatch any more messages. Since this includes | 49 // OnMessageReceived won't dispatch any more messages. Since this includes |
50 // OnRelease, this object won't get deleted until OnChannelError which might | 50 // OnRelease, this object won't get deleted until OnChannelError which might |
51 // not happen for a long time if this renderer process has a long lived | 51 // not happen for a long time if this renderer process has a long lived |
52 // plugin instance to the same process. So we delete this object manually. | 52 // plugin instance to the same process. So we delete this object manually. |
53 npobject_ = NULL; | 53 npobject_ = NULL; |
54 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 54 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
55 } | 55 } |
56 | 56 |
| 57 NPObject* NPObjectStub::GetUnderlyingNPObject() { |
| 58 return npobject_; |
| 59 } |
| 60 |
| 61 IPC::Channel::Listener* NPObjectStub::GetChannelListener() { |
| 62 return static_cast<IPC::Channel::Listener*>(this); |
| 63 } |
| 64 |
57 void NPObjectStub::OnMessageReceived(const IPC::Message& msg) { | 65 void NPObjectStub::OnMessageReceived(const IPC::Message& msg) { |
58 child_process_logging::SetActiveURL(page_url_); | 66 child_process_logging::SetActiveURL(page_url_); |
59 | 67 |
60 if (!npobject_) { | 68 if (!npobject_) { |
61 if (msg.is_sync()) { | 69 if (msg.is_sync()) { |
62 // The object could be garbage because the frame has gone away, so | 70 // The object could be garbage because the frame has gone away, so |
63 // just send an error reply to the caller. | 71 // just send an error reply to the caller. |
64 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); | 72 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); |
65 reply->set_reply_error(); | 73 reply->set_reply_error(); |
66 Send(reply); | 74 Send(reply); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_, | 390 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_, |
383 &script_string, &result_var); | 391 &script_string, &result_var); |
384 | 392 |
385 NPVariant_Param result_param; | 393 NPVariant_Param result_param; |
386 CreateNPVariantParam( | 394 CreateNPVariantParam( |
387 result_var, local_channel, &result_param, true, containing_window_, | 395 result_var, local_channel, &result_param, true, containing_window_, |
388 page_url_); | 396 page_url_); |
389 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); | 397 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); |
390 local_channel->Send(reply_msg); | 398 local_channel->Send(reply_msg); |
391 } | 399 } |
OLD | NEW |