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

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

Issue 22876025: The peer pointer was not being setup at all, fixed that and added a test case (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | « runtime/vm/dart_api_impl_test.cc ('k') | 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 "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 13417 matching lines...) Expand 10 before | Expand all | Expand 10 after
13428 13428
13429 13429
13430 void OneByteString::SetPeer(const String& str, 13430 void OneByteString::SetPeer(const String& str,
13431 void* peer, 13431 void* peer,
13432 Dart_PeerFinalizer cback) { 13432 Dart_PeerFinalizer cback) {
13433 ASSERT(!str.IsNull() && str.IsOneByteString()); 13433 ASSERT(!str.IsNull() && str.IsOneByteString());
13434 ASSERT(peer != NULL); 13434 ASSERT(peer != NULL);
13435 ExternalStringData<uint8_t>* ext_data = 13435 ExternalStringData<uint8_t>* ext_data =
13436 new ExternalStringData<uint8_t>(NULL, peer, cback); 13436 new ExternalStringData<uint8_t>(NULL, peer, cback);
13437 AddFinalizer(str, ext_data, OneByteString::Finalize); 13437 AddFinalizer(str, ext_data, OneByteString::Finalize);
13438 Isolate::Current()->heap()->SetPeer(str.raw(), peer);
13438 } 13439 }
13439 13440
13440 13441
13441 void OneByteString::Finalize(Dart_WeakPersistentHandle handle, void* peer) { 13442 void OneByteString::Finalize(Dart_WeakPersistentHandle handle, void* peer) {
13442 delete reinterpret_cast<ExternalStringData<uint8_t>*>(peer); 13443 delete reinterpret_cast<ExternalStringData<uint8_t>*>(peer);
13443 DeleteWeakPersistentHandle(handle); 13444 DeleteWeakPersistentHandle(handle);
13444 } 13445 }
13445 13446
13446 13447
13447 RawTwoByteString* TwoByteString::EscapeSpecialCharacters(const String& str) { 13448 RawTwoByteString* TwoByteString::EscapeSpecialCharacters(const String& str) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
13597 13598
13598 13599
13599 void TwoByteString::SetPeer(const String& str, 13600 void TwoByteString::SetPeer(const String& str,
13600 void* peer, 13601 void* peer,
13601 Dart_PeerFinalizer cback) { 13602 Dart_PeerFinalizer cback) {
13602 ASSERT(!str.IsNull() && str.IsTwoByteString()); 13603 ASSERT(!str.IsNull() && str.IsTwoByteString());
13603 ASSERT(peer != NULL); 13604 ASSERT(peer != NULL);
13604 ExternalStringData<uint16_t>* ext_data = 13605 ExternalStringData<uint16_t>* ext_data =
13605 new ExternalStringData<uint16_t>(NULL, peer, cback); 13606 new ExternalStringData<uint16_t>(NULL, peer, cback);
13606 AddFinalizer(str, ext_data, TwoByteString::Finalize); 13607 AddFinalizer(str, ext_data, TwoByteString::Finalize);
13608 Isolate::Current()->heap()->SetPeer(str.raw(), peer);
13607 } 13609 }
13608 13610
13609 13611
13610 void TwoByteString::Finalize(Dart_WeakPersistentHandle handle, void* peer) { 13612 void TwoByteString::Finalize(Dart_WeakPersistentHandle handle, void* peer) {
13611 delete reinterpret_cast<ExternalStringData<uint16_t>*>(peer); 13613 delete reinterpret_cast<ExternalStringData<uint16_t>*>(peer);
13612 DeleteWeakPersistentHandle(handle); 13614 DeleteWeakPersistentHandle(handle);
13613 } 13615 }
13614 13616
13615 13617
13616 RawExternalOneByteString* ExternalOneByteString::New( 13618 RawExternalOneByteString* ExternalOneByteString::New(
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
14772 } 14774 }
14773 14775
14774 14776
14775 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14777 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14776 stream->OpenObject(); 14778 stream->OpenObject();
14777 stream->CloseObject(); 14779 stream->CloseObject();
14778 } 14780 }
14779 14781
14780 14782
14781 } // namespace dart 14783 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698