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

Side by Side Diff: runtime/vm/object.h

Issue 11362009: New APIs for external byte arrays (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 8 years, 1 month 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
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/raw_object.h » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 4980 matching lines...) Expand 10 before | Expand all | Expand 10 after
4991 uint8_t At(intptr_t index) const { 4991 uint8_t At(intptr_t index) const {
4992 ASSERT((index >= 0) && (index < Length())); 4992 ASSERT((index >= 0) && (index < Length()));
4993 return raw_ptr()->external_data_->data()[index]; 4993 return raw_ptr()->external_data_->data()[index];
4994 } 4994 }
4995 4995
4996 void SetAt(intptr_t index, uint8_t value) const { 4996 void SetAt(intptr_t index, uint8_t value) const {
4997 ASSERT((index >= 0) && (index < Length())); 4997 ASSERT((index >= 0) && (index < Length()));
4998 raw_ptr()->external_data_->data()[index] = value; 4998 raw_ptr()->external_data_->data()[index] = value;
4999 } 4999 }
5000 5000
5001 void* GetData() const {
5002 return raw_ptr()->external_data_->data();
5003 }
5004
5001 void* GetPeer() const { 5005 void* GetPeer() const {
5002 return raw_ptr()->external_data_->peer(); 5006 return raw_ptr()->external_data_->peer();
5003 } 5007 }
5004 5008
5005 static const intptr_t kBytesPerElement = 1; 5009 static const intptr_t kBytesPerElement = 1;
5006 5010
5007 // Since external arrays may be serialized to non-external ones, 5011 // Since external arrays may be serialized to non-external ones,
5008 // enforce the same maximum element count. 5012 // enforce the same maximum element count.
5009 static const intptr_t kMaxElements = Uint8Array::kMaxElements; 5013 static const intptr_t kMaxElements = Uint8Array::kMaxElements;
5010 5014
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
5789 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 5793 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
5790 return false; 5794 return false;
5791 } 5795 }
5792 } 5796 }
5793 return true; 5797 return true;
5794 } 5798 }
5795 5799
5796 } // namespace dart 5800 } // namespace dart
5797 5801
5798 #endif // VM_OBJECT_H_ 5802 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698