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

Side by Side Diff: Source/bindings/dart/DartStringCache.cpp

Issue 185643003: Changes to use the modified dart API for (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1750/
Patch Set: Created 6 years, 9 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 | « Source/bindings/dart/DartStringCache.h ('k') | Source/bindings/dart/DartUtilities.cpp » ('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 2012, Google Inc. 1 // Copyright 2012, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 25 matching lines...) Expand all
36 namespace WebCore { 36 namespace WebCore {
37 37
38 DartStringCache::DartStringCache() 38 DartStringCache::DartStringCache()
39 { 39 {
40 m_lastStringImpl = 0; 40 m_lastStringImpl = 0;
41 m_lastDartString = 0; 41 m_lastDartString = 0;
42 } 42 }
43 43
44 void DartStringCache::clearWeakHandles() 44 void DartStringCache::clearWeakHandles()
45 { 45 {
46 Dart_Isolate isolate = Dart_CurrentIsolate();
46 for (StringCache::iterator it = m_stringCache.begin(); it != m_stringCache.e nd(); ++it) { 47 for (StringCache::iterator it = m_stringCache.begin(); it != m_stringCache.e nd(); ++it) {
47 it->key->deref(); 48 it->key->deref();
48 Dart_DeleteWeakPersistentHandle(it->value); 49 Dart_DeleteWeakPersistentHandle(isolate, it->value);
49 } 50 }
50 m_stringCache.clear(); 51 m_stringCache.clear();
51 m_lastStringImpl = 0; 52 m_lastStringImpl = 0;
52 m_lastDartString = 0; 53 m_lastDartString = 0;
53 } 54 }
54 55
55 Dart_WeakPersistentHandle DartStringCache::getSlow(StringImpl* stringImpl, bool autoDartScope) 56 Dart_WeakPersistentHandle DartStringCache::getSlow(StringImpl* stringImpl, bool autoDartScope)
56 { 57 {
57 ASSERT(stringImpl); 58 ASSERT(stringImpl);
58 59
(...skipping 18 matching lines...) Expand all
77 78
78 m_lastStringImpl = stringImpl; 79 m_lastStringImpl = stringImpl;
79 m_lastDartString = wrapper; 80 m_lastDartString = wrapper;
80 81
81 if (!autoDartScope) 82 if (!autoDartScope)
82 Dart_ExitScope(); 83 Dart_ExitScope();
83 84
84 return wrapper; 85 return wrapper;
85 } 86 }
86 87
87 void DartStringCache::handleFinalizer(Dart_WeakPersistentHandle handle, void* pe er) 88 void DartStringCache::handleFinalizer(Dart_Isolate isolate, Dart_WeakPersistentH andle handle, void* peer)
88 { 89 {
89 StringImpl* stringImpl = reinterpret_cast<StringImpl*>(peer); 90 StringImpl* stringImpl = reinterpret_cast<StringImpl*>(peer);
90 DartStringCache& stringCache = DartDOMData::current()->stringCache(); 91 DartDOMData* domData = reinterpret_cast<DartDOMData*>(Dart_IsolateData(isola te));
92 DartStringCache& stringCache = domData->stringCache();
91 Dart_WeakPersistentHandle ALLOW_UNUSED cached = stringCache.m_stringCache.ta ke(stringImpl); 93 Dart_WeakPersistentHandle ALLOW_UNUSED cached = stringCache.m_stringCache.ta ke(stringImpl);
92 ASSERT(handle == cached); 94 ASSERT(handle == cached);
93 if (stringCache.m_lastDartString == handle) { 95 if (stringCache.m_lastDartString == handle) {
94 stringCache.m_lastStringImpl = 0; 96 stringCache.m_lastStringImpl = 0;
95 stringCache.m_lastDartString = 0; 97 stringCache.m_lastDartString = 0;
96 } 98 }
97 Dart_DeleteWeakPersistentHandle(handle); 99 Dart_DeleteWeakPersistentHandle(isolate, handle);
98 stringImpl->deref(); 100 stringImpl->deref();
99 } 101 }
100 102
101 } 103 }
OLDNEW
« no previous file with comments | « Source/bindings/dart/DartStringCache.h ('k') | Source/bindings/dart/DartUtilities.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698