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

Side by Side Diff: ppapi/shared_impl/scoped_pp_var.cc

Issue 459553003: Replace NPObject usage in ppapi with gin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « ppapi/shared_impl/scoped_pp_var.h ('k') | ppapi/tests/test_post_message.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/shared_impl/scoped_pp_var.h" 5 #include "ppapi/shared_impl/scoped_pp_var.h"
6 6
7 #include "ppapi/c/dev/ppb_memory_dev.h" 7 #include "ppapi/c/dev/ppb_memory_dev.h"
8 #include "ppapi/shared_impl/ppapi_globals.h" 8 #include "ppapi/shared_impl/ppapi_globals.h"
9 #include "ppapi/shared_impl/var_tracker.h" 9 #include "ppapi/shared_impl/var_tracker.h"
10 #include "ppapi/thunk/thunk.h" 10 #include "ppapi/thunk/thunk.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 ScopedPPVarArray::~ScopedPPVarArray() { 68 ScopedPPVarArray::~ScopedPPVarArray() {
69 for (size_t i = 0; i < size_; ++i) 69 for (size_t i = 0; i < size_; ++i)
70 CallRelease(array_[i]); 70 CallRelease(array_[i]);
71 if (size_ > 0) 71 if (size_ > 0)
72 thunk::GetPPB_Memory_Dev_0_1_Thunk()->MemFree(array_); 72 thunk::GetPPB_Memory_Dev_0_1_Thunk()->MemFree(array_);
73 73
74 } 74 }
75 75
76 PP_Var* ScopedPPVarArray::Release(const PassPPBMemoryAllocatedArray&, 76 PP_Var* ScopedPPVarArray::Release(const PassPPBMemoryAllocatedArray&) {
77 size_t* size) {
78 PP_Var* result = array_; 77 PP_Var* result = array_;
79 *size = size_;
80 array_ = NULL; 78 array_ = NULL;
81 size_ = 0; 79 size_ = 0;
82 return result; 80 return result;
83 } 81 }
84 82
85 void ScopedPPVarArray::Set(size_t index, PP_Var var) { 83 void ScopedPPVarArray::Set(size_t index, const ScopedPPVar& var) {
86 DCHECK(index < size_); 84 DCHECK(index < size_);
87 CallAddRef(var); 85 CallAddRef(var.get());
88 CallRelease(array_[index]); 86 CallRelease(array_[index]);
89 array_[index] = var; 87 array_[index] = var.get();
90 } 88 }
91 89
92 } // namespace ppapi 90 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/scoped_pp_var.h ('k') | ppapi/tests/test_post_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698