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 #include "content/plugin/npobject_stub.h" | 5 #include "content/plugin/npobject_stub.h" |
6 | 6 |
7 #include "content/common/content_client.h" | 7 #include "content/common/content_client.h" |
8 #include "content/common/plugin_messages.h" | 8 #include "content/common/plugin_messages.h" |
9 #include "content/plugin/npobject_util.h" | 9 #include "content/plugin/npobject_util.h" |
10 #include "content/plugin/plugin_channel_base.h" | 10 #include "content/plugin/plugin_channel_base.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 base::debug::Alias(&liveness_token); | 109 base::debug::Alias(&liveness_token); |
110 | 110 |
111 CHECK_EQ(liveness_token, kTokenAlive); | 111 CHECK_EQ(liveness_token, kTokenAlive); |
112 } | 112 } |
113 | 113 |
114 void NPObjectStub::DeleteSoon(bool release_npobject) { | 114 void NPObjectStub::DeleteSoon(bool release_npobject) { |
115 CheckIsAlive(); | 115 CheckIsAlive(); |
116 | 116 |
117 if (npobject_) { | 117 if (npobject_) { |
118 channel_->RemoveMappingForNPObjectStub(route_id_, npobject_); | 118 channel_->RemoveMappingForNPObjectStub(route_id_, npobject_); |
| 119 |
| 120 // We need to NULL npobject_ prior to calling releaseObject() to avoid |
| 121 // problems with re-entrancy. See http://crbug.com/94179#c17 for more |
| 122 // details on how this can happen. |
| 123 NPObject* npobject = npobject_; |
| 124 npobject_ = NULL; |
| 125 |
119 if (release_npobject) | 126 if (release_npobject) |
120 WebBindings::releaseObject(npobject_); | 127 WebBindings::releaseObject(npobject); |
121 npobject_ = NULL; | 128 |
122 MessageLoop::current()->PostTask( | 129 MessageLoop::current()->PostTask( |
123 FROM_HERE, | 130 FROM_HERE, |
124 NewRunnableFunction( | 131 NewRunnableFunction( |
125 &NPObjectStub::DeleteSoonHelper, | 132 &NPObjectStub::DeleteSoonHelper, |
126 base::debug::StackTrace(), | 133 base::debug::StackTrace(), |
127 this)); | 134 this)); |
128 } | 135 } |
129 } | 136 } |
130 | 137 |
131 bool NPObjectStub::Send(IPC::Message* msg) { | 138 bool NPObjectStub::Send(IPC::Message* msg) { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 result_var, channel_, &result_param, true, containing_window_, page_url_); | 471 result_var, channel_, &result_param, true, containing_window_, page_url_); |
465 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); | 472 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); |
466 channel_->Send(reply_msg); | 473 channel_->Send(reply_msg); |
467 } | 474 } |
468 | 475 |
469 // Restore compiler optimizations and warnings. | 476 // Restore compiler optimizations and warnings. |
470 #if defined(COMPILER_MSVC) | 477 #if defined(COMPILER_MSVC) |
471 MSVC_POP_WARNING() | 478 MSVC_POP_WARNING() |
472 #pragma optimize("", on) | 479 #pragma optimize("", on) |
473 #endif | 480 #endif |
OLD | NEW |