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

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

Issue 9403039: PPAPI: Really force-free NPObjects on Instance destruction. (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 | « webkit/plugins/ppapi/host_var_tracker.cc ('k') | webkit/plugins/ppapi/npobject_var.h » ('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) 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 "webkit/plugins/ppapi/message_channel.h" 5 #include "webkit/plugins/ppapi/message_channel.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 405
406 MessageChannel::~MessageChannel() { 406 MessageChannel::~MessageChannel() {
407 WebBindings::releaseObject(np_object_); 407 WebBindings::releaseObject(np_object_);
408 if (passthrough_object_) 408 if (passthrough_object_)
409 WebBindings::releaseObject(passthrough_object_); 409 WebBindings::releaseObject(passthrough_object_);
410 } 410 }
411 411
412 void MessageChannel::SetPassthroughObject(NPObject* passthrough) { 412 void MessageChannel::SetPassthroughObject(NPObject* passthrough) {
413 // Retain the passthrough object; We need to ensure it lives as long as this 413 // Retain the passthrough object; We need to ensure it lives as long as this
414 // MessageChannel. 414 // MessageChannel.
415 WebBindings::retainObject(passthrough); 415 if (passthrough)
416 WebBindings::retainObject(passthrough);
416 417
417 // If we had a passthrough set already, release it. Note that we retain the 418 // If we had a passthrough set already, release it. Note that we retain the
418 // incoming passthrough object first, so that we behave correctly if anyone 419 // incoming passthrough object first, so that we behave correctly if anyone
419 // invokes: 420 // invokes:
420 // SetPassthroughObject(passthrough_object()); 421 // SetPassthroughObject(passthrough_object());
421 if (passthrough_object_) 422 if (passthrough_object_)
422 WebBindings::releaseObject(passthrough_object_); 423 WebBindings::releaseObject(passthrough_object_);
423 424
424 passthrough_object_ = passthrough; 425 passthrough_object_ = passthrough;
425 } 426 }
426 427
427 } // namespace ppapi 428 } // namespace ppapi
428 } // namespace webkit 429 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/host_var_tracker.cc ('k') | webkit/plugins/ppapi/npobject_var.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698