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

Side by Side Diff: mojo/edk/embedder/simple_platform_shared_buffer.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup Created 5 years, 2 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
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 "third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer.h " 5 #include "mojo/edk/embedder/simple_platform_shared_buffer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle_utils.h" 8 #include "mojo/edk/embedder/platform_handle_utils.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 namespace embedder { 11 namespace edk {
12 12
13 // static 13 // static
14 SimplePlatformSharedBuffer* SimplePlatformSharedBuffer::Create( 14 SimplePlatformSharedBuffer* SimplePlatformSharedBuffer::Create(
15 size_t num_bytes) { 15 size_t num_bytes) {
16 DCHECK_GT(num_bytes, 0u); 16 DCHECK_GT(num_bytes, 0u);
17 17
18 SimplePlatformSharedBuffer* rv = new SimplePlatformSharedBuffer(num_bytes); 18 SimplePlatformSharedBuffer* rv = new SimplePlatformSharedBuffer(num_bytes);
19 if (!rv->Init()) { 19 if (!rv->Init()) {
20 // We can't just delete it directly, due to the "in destructor" (debug) 20 // We can't just delete it directly, due to the "in destructor" (debug)
21 // check. 21 // check.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 scoped_ptr<PlatformSharedBufferMapping> SimplePlatformSharedBuffer::MapNoCheck( 72 scoped_ptr<PlatformSharedBufferMapping> SimplePlatformSharedBuffer::MapNoCheck(
73 size_t offset, 73 size_t offset,
74 size_t length) { 74 size_t length) {
75 DCHECK(IsValidMap(offset, length)); 75 DCHECK(IsValidMap(offset, length));
76 return MapImpl(offset, length); 76 return MapImpl(offset, length);
77 } 77 }
78 78
79 ScopedPlatformHandle SimplePlatformSharedBuffer::DuplicatePlatformHandle() { 79 ScopedPlatformHandle SimplePlatformSharedBuffer::DuplicatePlatformHandle() {
80 return mojo::embedder::DuplicatePlatformHandle(handle_.get()); 80 return mojo::edk::DuplicatePlatformHandle(handle_.get());
81 } 81 }
82 82
83 ScopedPlatformHandle SimplePlatformSharedBuffer::PassPlatformHandle() { 83 ScopedPlatformHandle SimplePlatformSharedBuffer::PassPlatformHandle() {
84 DCHECK(HasOneRef()); 84 DCHECK(HasOneRef());
85 return handle_.Pass(); 85 return handle_.Pass();
86 } 86 }
87 87
88 SimplePlatformSharedBuffer::SimplePlatformSharedBuffer(size_t num_bytes) 88 SimplePlatformSharedBuffer::SimplePlatformSharedBuffer(size_t num_bytes)
89 : num_bytes_(num_bytes) { 89 : num_bytes_(num_bytes) {
90 } 90 }
91 91
92 SimplePlatformSharedBuffer::~SimplePlatformSharedBuffer() { 92 SimplePlatformSharedBuffer::~SimplePlatformSharedBuffer() {
93 } 93 }
94 94
95 SimplePlatformSharedBufferMapping::~SimplePlatformSharedBufferMapping() { 95 SimplePlatformSharedBufferMapping::~SimplePlatformSharedBufferMapping() {
96 Unmap(); 96 Unmap();
97 } 97 }
98 98
99 void* SimplePlatformSharedBufferMapping::GetBase() const { 99 void* SimplePlatformSharedBufferMapping::GetBase() const {
100 return base_; 100 return base_;
101 } 101 }
102 102
103 size_t SimplePlatformSharedBufferMapping::GetLength() const { 103 size_t SimplePlatformSharedBufferMapping::GetLength() const {
104 return length_; 104 return length_;
105 } 105 }
106 106
107 } // namespace embedder 107 } // namespace edk
108 } // namespace mojo 108 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698