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

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

Issue 15070014: - Create a local scope so that the GC can collect the external (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« 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) 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 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "platform/json.h" 7 #include "platform/json.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 1372
1373 obj = Dart_NewTypedData(kFloat32x4, 10); 1373 obj = Dart_NewTypedData(kFloat32x4, 10);
1374 EXPECT_VALID(obj); 1374 EXPECT_VALID(obj);
1375 CheckFloat32x4Data(obj); 1375 CheckFloat32x4Data(obj);
1376 1376
1377 int peer = 0; 1377 int peer = 0;
1378 float data[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1378 float data[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
1379 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1379 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
1380 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1380 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
1381 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; 1381 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
1382 obj = Dart_NewExternalTypedData(kFloat32x4, 1382 // Push a scope so that we can collect the local handle created as part of
1383 data, 1383 // Dart_NewExternalTypedData.
1384 10, 1384 Dart_EnterScope();
1385 &peer, 1385 {
1386 ExternalTypedDataCallbackFinalizer); 1386 Dart_Handle lcl = Dart_NewExternalTypedData(
1387 CheckFloat32x4Data(obj); 1387 kFloat32x4, data, 10, &peer, ExternalTypedDataCallbackFinalizer);
1388 CheckFloat32x4Data(lcl);
1389 }
1390 Dart_ExitScope();
1388 Isolate::Current()->heap()->CollectGarbage(Heap::kNew); 1391 Isolate::Current()->heap()->CollectGarbage(Heap::kNew);
1389 EXPECT(peer == 42); 1392 EXPECT(peer == 42);
1390 } 1393 }
1391 1394
1392 1395
1393 // Unit test for entering a scope, creating a local handle and exiting 1396 // Unit test for entering a scope, creating a local handle and exiting
1394 // the scope. 1397 // the scope.
1395 UNIT_TEST_CASE(EnterExitScope) { 1398 UNIT_TEST_CASE(EnterExitScope) {
1396 TestIsolateScope __test_isolate__; 1399 TestIsolateScope __test_isolate__;
1397 1400
(...skipping 6279 matching lines...) Expand 10 before | Expand all | Expand 10 after
7677 NewString("main"), 7680 NewString("main"),
7678 0, 7681 0,
7679 NULL); 7682 NULL);
7680 int64_t value = 0; 7683 int64_t value = 0;
7681 result = Dart_IntegerToInt64(result, &value); 7684 result = Dart_IntegerToInt64(result, &value);
7682 EXPECT_VALID(result); 7685 EXPECT_VALID(result);
7683 EXPECT_EQ(260, value); 7686 EXPECT_EQ(260, value);
7684 } 7687 }
7685 7688
7686 } // namespace dart 7689 } // 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