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

Side by Side Diff: ppapi/cpp/var_array_buffer.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
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/cpp/var_array_buffer.h" 5 #include "ppapi/cpp/var_array_buffer.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "ppapi/c/ppb_var_array_buffer.h" 9 #include "ppapi/c/ppb_var_array_buffer.h"
10 #include "ppapi/cpp/logging.h" 10 #include "ppapi/cpp/logging.h"
(...skipping 12 matching lines...) Expand all
23 VarArrayBuffer::VarArrayBuffer(const Var& var) : Var(var) { 23 VarArrayBuffer::VarArrayBuffer(const Var& var) : Var(var) {
24 if (!var.is_array_buffer()) { 24 if (!var.is_array_buffer()) {
25 PP_NOTREACHED(); 25 PP_NOTREACHED();
26 var_ = PP_MakeNull(); 26 var_ = PP_MakeNull();
27 } 27 }
28 } 28 }
29 29
30 VarArrayBuffer::VarArrayBuffer(uint32_t size_in_bytes) { 30 VarArrayBuffer::VarArrayBuffer(uint32_t size_in_bytes) {
31 if (has_interface<PPB_VarArrayBuffer_1_0>()) { 31 if (has_interface<PPB_VarArrayBuffer_1_0>()) {
32 var_ = get_interface<PPB_VarArrayBuffer_1_0>()->Create(size_in_bytes); 32 var_ = get_interface<PPB_VarArrayBuffer_1_0>()->Create(size_in_bytes);
33 needs_release_ = true;
34 } else { 33 } else {
35 PP_NOTREACHED(); 34 PP_NOTREACHED();
36 var_ = PP_MakeNull(); 35 var_ = PP_MakeNull();
37 } 36 }
37 needs_management_ = true;
38 } 38 }
39 39
40 pp::VarArrayBuffer& VarArrayBuffer::operator=(const VarArrayBuffer& other) { 40 pp::VarArrayBuffer& VarArrayBuffer::operator=(const VarArrayBuffer& other) {
41 Var::operator=(other); 41 Var::operator=(other);
42 return *this; 42 return *this;
43 } 43 }
44 44
45 pp::Var& VarArrayBuffer::operator=(const Var& other) { 45 pp::Var& VarArrayBuffer::operator=(const Var& other) {
46 if (other.is_array_buffer()) { 46 if (other.is_array_buffer()) {
47 return Var::operator=(other); 47 return Var::operator=(other);
(...skipping 20 matching lines...) Expand all
68 } 68 }
69 69
70 void VarArrayBuffer::Unmap() { 70 void VarArrayBuffer::Unmap() {
71 if (is_array_buffer() && has_interface<PPB_VarArrayBuffer_1_0>()) 71 if (is_array_buffer() && has_interface<PPB_VarArrayBuffer_1_0>())
72 get_interface<PPB_VarArrayBuffer_1_0>()->Unmap(var_); 72 get_interface<PPB_VarArrayBuffer_1_0>()->Unmap(var_);
73 else 73 else
74 PP_NOTREACHED(); 74 PP_NOTREACHED();
75 } 75 }
76 76
77 } // namespace pp 77 } // namespace pp
OLDNEW
« ppapi/cpp/var.cc ('K') | « ppapi/cpp/var.cc ('k') | ppapi/cpp/websocket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698