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

Side by Side Diff: mojo/public/cpp/bindings/lib/fixed_buffer.cc

Issue 1524613002: [mojo] Use base::Pickle for Message storage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: happy compiler happy robots Created 5 years 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
« no previous file with comments | « mojo/public/cpp/bindings/lib/fixed_buffer.h ('k') | mojo/public/cpp/bindings/lib/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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/public/cpp/bindings/lib/fixed_buffer.h" 5 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 20 matching lines...) Expand all
31 MOJO_DCHECK(false) << "Not reached"; 31 MOJO_DCHECK(false) << "Not reached";
32 return nullptr; 32 return nullptr;
33 } 33 }
34 34
35 char* result = ptr_ + cursor_; 35 char* result = ptr_ + cursor_;
36 cursor_ += delta; 36 cursor_ += delta;
37 37
38 return result; 38 return result;
39 } 39 }
40 40
41 PickleBuffer* FixedBuffer::AsPickleBuffer() { return nullptr; }
42
41 FixedBufferForTesting::FixedBufferForTesting(size_t size) { 43 FixedBufferForTesting::FixedBufferForTesting(size_t size) {
42 size_ = internal::Align(size); 44 size_ = internal::Align(size);
43 // Use calloc here to ensure all message memory is zero'd out. 45 // Use calloc here to ensure all message memory is zero'd out.
44 ptr_ = static_cast<char*>(calloc(size_, 1)); 46 ptr_ = static_cast<char*>(calloc(size_, 1));
45 } 47 }
46 48
47 FixedBufferForTesting::~FixedBufferForTesting() { 49 FixedBufferForTesting::~FixedBufferForTesting() {
48 free(ptr_); 50 free(ptr_);
49 } 51 }
50 52
51 void* FixedBufferForTesting::Leak() { 53 void* FixedBufferForTesting::Leak() {
52 char* ptr = ptr_; 54 char* ptr = ptr_;
53 ptr_ = nullptr; 55 ptr_ = nullptr;
54 cursor_ = 0; 56 cursor_ = 0;
55 size_ = 0; 57 size_ = 0;
56 return ptr; 58 return ptr;
57 } 59 }
58 60
59 } // namespace internal 61 } // namespace internal
60 } // namespace mojo 62 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/fixed_buffer.h ('k') | mojo/public/cpp/bindings/lib/message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698