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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.h

Issue 443693002: [NaCl SDK] nacl_io: Remove use of new/delete for data buffers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_ 5 #ifndef LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_
6 #define LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_ 6 #define LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_
7 7
8 #include "nacl_io/node.h" 8 #include "nacl_io/node.h"
9 9
10 #include <vector>
11
12 namespace nacl_io { 10 namespace nacl_io {
13 11
14 class MemFsNode : public Node { 12 class MemFsNode : public Node {
15 public: 13 public:
16 explicit MemFsNode(Filesystem* filesystem); 14 explicit MemFsNode(Filesystem* filesystem);
17 15
18 protected: 16 protected:
19 virtual ~MemFsNode(); 17 virtual ~MemFsNode();
20 18
21 public: 19 public:
22 // Normal read/write operations on a file 20 // Normal read/write operations on a file
23 virtual Error Read(const HandleAttr& attr, 21 virtual Error Read(const HandleAttr& attr,
24 void* buf, 22 void* buf,
25 size_t count, 23 size_t count,
26 int* out_bytes); 24 int* out_bytes);
27 virtual Error Write(const HandleAttr& attr, 25 virtual Error Write(const HandleAttr& attr,
28 const void* buf, 26 const void* buf,
29 size_t count, 27 size_t count,
30 int* out_bytes); 28 int* out_bytes);
31 virtual Error FTruncate(off_t size); 29 virtual Error FTruncate(off_t size);
32 30
33 private: 31 private:
34 void Resize(off_t size); 32 Error Resize(off_t size);
35 33
36 std::vector<char> data_; 34 char* data_;
35 size_t data_capacity_;
37 friend class MemFs; 36 friend class MemFs;
38 }; 37 };
39 38
40 } // namespace nacl_io 39 } // namespace nacl_io
41 40
42 #endif // LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_ 41 #endif // LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698