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

Side by Side Diff: ppapi/cpp/private/var_private.cc

Issue 10905128: Pepper WebSocket API: Fix memory leak issue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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 | « no previous file | ppapi/cpp/var.h » ('j') | ppapi/cpp/var.h » ('J')
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 "ppapi/cpp/private/var_private.h" 5 #include "ppapi/cpp/private/var_private.h"
6 6
7 #include "ppapi/c/dev/ppb_memory_dev.h" 7 #include "ppapi/c/dev/ppb_memory_dev.h"
8 #include "ppapi/c/dev/ppb_var_deprecated.h" 8 #include "ppapi/c/dev/ppb_var_deprecated.h"
9 #include "ppapi/cpp/instance_handle.h" 9 #include "ppapi/cpp/instance_handle.h"
10 #include "ppapi/cpp/private/instance_private.h" 10 #include "ppapi/cpp/private/instance_private.h"
(...skipping 11 matching lines...) Expand all
22 22
23 } // namespace 23 } // namespace
24 24
25 using namespace deprecated; 25 using namespace deprecated;
26 26
27 VarPrivate::VarPrivate(const InstanceHandle& instance, 27 VarPrivate::VarPrivate(const InstanceHandle& instance,
28 ScriptableObject* object) { 28 ScriptableObject* object) {
29 if (has_interface<PPB_Var_Deprecated>()) { 29 if (has_interface<PPB_Var_Deprecated>()) {
30 var_ = get_interface<PPB_Var_Deprecated>()->CreateObject( 30 var_ = get_interface<PPB_Var_Deprecated>()->CreateObject(
31 instance.pp_instance(), object->GetClass(), object); 31 instance.pp_instance(), object->GetClass(), object);
32 needs_release_ = true;
33 } else { 32 } else {
34 var_.type = PP_VARTYPE_NULL; 33 var_.type = PP_VARTYPE_NULL;
35 var_.padding = 0; 34 var_.padding = 0;
36 needs_release_ = false;
37 } 35 }
36 needs_management_ = true;
38 } 37 }
39 38
40 ScriptableObject* VarPrivate::AsScriptableObject() const { 39 ScriptableObject* VarPrivate::AsScriptableObject() const {
41 if (!is_object()) { 40 if (!is_object()) {
42 PP_NOTREACHED(); 41 PP_NOTREACHED();
43 } else if (has_interface<PPB_Var_Deprecated>()) { 42 } else if (has_interface<PPB_Var_Deprecated>()) {
44 void* object = NULL; 43 void* object = NULL;
45 if (get_interface<PPB_Var_Deprecated>()->IsInstanceOf( 44 if (get_interface<PPB_Var_Deprecated>()->IsInstanceOf(
46 var_, ScriptableObject::GetClass(), &object)) { 45 var_, ScriptableObject::GetClass(), &object)) {
47 return reinterpret_cast<ScriptableObject*>(object); 46 return reinterpret_cast<ScriptableObject*>(object);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 const Var& arg2, const Var& arg3, const Var& arg4, 181 const Var& arg2, const Var& arg3, const Var& arg4,
183 Var* exception) { 182 Var* exception) {
184 if (!has_interface<PPB_Var_Deprecated>()) 183 if (!has_interface<PPB_Var_Deprecated>())
185 return Var(); 184 return Var();
186 PP_Var args[4] = {arg1.pp_var(), arg2.pp_var(), arg3.pp_var(), arg4.pp_var()}; 185 PP_Var args[4] = {arg1.pp_var(), arg2.pp_var(), arg3.pp_var(), arg4.pp_var()};
187 return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call( 186 return Var(PassRef(), get_interface<PPB_Var_Deprecated>()->Call(
188 var_, method_name.pp_var(), 4, args, OutException(exception).get())); 187 var_, method_name.pp_var(), 4, args, OutException(exception).get()));
189 } 188 }
190 189
191 } // namespace pp 190 } // namespace pp
OLDNEW
« no previous file with comments | « no previous file | ppapi/cpp/var.h » ('j') | ppapi/cpp/var.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698