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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 1182123002: Fix bug in Dart_GetTypeOfExternalTypedData. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comment Created 5 years, 6 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 | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 3223 matching lines...) Expand 10 before | Expand all | Expand 10 after
3234 return GetType(class_id); 3234 return GetType(class_id);
3235 } 3235 }
3236 return Dart_TypedData_kInvalid; 3236 return Dart_TypedData_kInvalid;
3237 } 3237 }
3238 3238
3239 3239
3240 DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData( 3240 DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData(
3241 Dart_Handle object) { 3241 Dart_Handle object) {
3242 TRACE_API_CALL(CURRENT_FUNC); 3242 TRACE_API_CALL(CURRENT_FUNC);
3243 intptr_t class_id = Api::ClassId(object); 3243 intptr_t class_id = Api::ClassId(object);
3244 if (RawObject::IsExternalTypedDataClassId(class_id) || 3244 if (RawObject::IsExternalTypedDataClassId(class_id)) {
3245 RawObject::IsTypedDataViewClassId(class_id)) {
3246 return GetType(class_id); 3245 return GetType(class_id);
3247 } 3246 }
3247 if (RawObject::IsTypedDataViewClassId(class_id)) {
3248 // Check if data object of the view is external.
3249 Isolate* isolate = Isolate::Current();
3250 const Instance& view_obj = Api::UnwrapInstanceHandle(isolate, object);
3251 ASSERT(!view_obj.IsNull());
3252 const Instance& data_obj =
3253 Instance::Handle(isolate, TypedDataView::Data(view_obj));
3254 if (ExternalTypedData::IsExternalTypedData(data_obj)) {
3255 return GetType(class_id);
3256 }
3257 }
3248 return Dart_TypedData_kInvalid; 3258 return Dart_TypedData_kInvalid;
3249 } 3259 }
3250 3260
3251 3261
3252 static RawObject* GetByteDataConstructor(Isolate* isolate, 3262 static RawObject* GetByteDataConstructor(Isolate* isolate,
3253 const String& constructor_name, 3263 const String& constructor_name,
3254 intptr_t num_args) { 3264 intptr_t num_args) {
3255 const Library& lib = 3265 const Library& lib =
3256 Library::Handle(isolate->object_store()->typed_data_library()); 3266 Library::Handle(isolate->object_store()->typed_data_library());
3257 ASSERT(!lib.IsNull()); 3267 ASSERT(!lib.IsNull());
(...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after
5652 5662
5653 5663
5654 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 5664 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
5655 const char* name, 5665 const char* name,
5656 Dart_ServiceRequestCallback callback, 5666 Dart_ServiceRequestCallback callback,
5657 void* user_data) { 5667 void* user_data) {
5658 Service::RegisterRootEmbedderCallback(name, callback, user_data); 5668 Service::RegisterRootEmbedderCallback(name, callback, user_data);
5659 } 5669 }
5660 5670
5661 } // namespace dart 5671 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698