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

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

Issue 593313006: Revert of Mojo: Convert scoped_ptr<...>() to nullptr in mojo/embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | mojo/embedder/simple_platform_shared_buffer_posix.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/embedder/simple_platform_shared_buffer.h" 5 #include "mojo/embedder/simple_platform_shared_buffer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/embedder/platform_handle_utils.h" 8 #include "mojo/embedder/platform_handle_utils.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 size_t SimplePlatformSharedBuffer::GetNumBytes() const { 47 size_t SimplePlatformSharedBuffer::GetNumBytes() const {
48 return num_bytes_; 48 return num_bytes_;
49 } 49 }
50 50
51 scoped_ptr<PlatformSharedBufferMapping> SimplePlatformSharedBuffer::Map( 51 scoped_ptr<PlatformSharedBufferMapping> SimplePlatformSharedBuffer::Map(
52 size_t offset, 52 size_t offset,
53 size_t length) { 53 size_t length) {
54 if (!IsValidMap(offset, length)) 54 if (!IsValidMap(offset, length))
55 return nullptr; 55 return scoped_ptr<PlatformSharedBufferMapping>();
56 56
57 return MapNoCheck(offset, length); 57 return MapNoCheck(offset, length);
58 } 58 }
59 59
60 bool SimplePlatformSharedBuffer::IsValidMap(size_t offset, size_t length) { 60 bool SimplePlatformSharedBuffer::IsValidMap(size_t offset, size_t length) {
61 if (offset > num_bytes_ || length == 0) 61 if (offset > num_bytes_ || length == 0)
62 return false; 62 return false;
63 63
64 // Note: This is an overflow-safe check of |offset + length > num_bytes_| 64 // Note: This is an overflow-safe check of |offset + length > num_bytes_|
65 // (that |num_bytes >= offset| is verified above). 65 // (that |num_bytes >= offset| is verified above).
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 embedder
108 } // namespace mojo 108 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/embedder/simple_platform_shared_buffer_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698