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

Side by Side Diff: Source/bindings/core/v8/V8ValueCache.h

Issue 684803002: Move the v8::Isolate* parameter to the first parameter of various binding methods in third_party/We… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8ValueCache.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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 class StringCache { 61 class StringCache {
62 public: 62 public:
63 StringCache(v8::Isolate* isolate) : m_stringCache(isolate) { } 63 StringCache(v8::Isolate* isolate) : m_stringCache(isolate) { }
64 ~StringCache(); 64 ~StringCache();
65 65
66 v8::Handle<v8::String> v8ExternalString(StringImpl* stringImpl, v8::Isolate* isolate) 66 v8::Handle<v8::String> v8ExternalString(StringImpl* stringImpl, v8::Isolate* isolate)
67 { 67 {
68 ASSERT(stringImpl); 68 ASSERT(stringImpl);
69 if (m_lastStringImpl.get() == stringImpl) 69 if (m_lastStringImpl.get() == stringImpl)
70 return m_lastV8String.NewLocal(isolate); 70 return m_lastV8String.NewLocal(isolate);
71 return v8ExternalStringSlow(stringImpl, isolate); 71 return v8ExternalStringSlow(isolate, stringImpl);
72 } 72 }
73 73
74 void setReturnValueFromString(v8::ReturnValue<v8::Value> returnValue, String Impl* stringImpl) 74 void setReturnValueFromString(v8::ReturnValue<v8::Value> returnValue, String Impl* stringImpl)
75 { 75 {
76 ASSERT(stringImpl); 76 ASSERT(stringImpl);
77 if (m_lastStringImpl.get() == stringImpl) 77 if (m_lastStringImpl.get() == stringImpl)
78 m_lastV8String.SetReturnValue(returnValue); 78 m_lastV8String.SetReturnValue(returnValue);
79 else 79 else
80 setReturnValueFromStringSlow(returnValue, stringImpl); 80 setReturnValueFromStringSlow(returnValue, stringImpl);
81 } 81 }
82 82
83 friend class StringCacheMapTraits; 83 friend class StringCacheMapTraits;
84 84
85 private: 85 private:
86 v8::Handle<v8::String> v8ExternalStringSlow(StringImpl*, v8::Isolate*); 86 v8::Handle<v8::String> v8ExternalStringSlow(v8::Isolate*, StringImpl*);
87 void setReturnValueFromStringSlow(v8::ReturnValue<v8::Value>, StringImpl*); 87 void setReturnValueFromStringSlow(v8::ReturnValue<v8::Value>, StringImpl*);
88 v8::Local<v8::String> createStringAndInsertIntoCache(StringImpl*, v8::Isolat e*); 88 v8::Local<v8::String> createStringAndInsertIntoCache(v8::Isolate*, StringImp l*);
89 void InvalidateLastString(); 89 void InvalidateLastString();
90 90
91 StringCacheMapTraits::MapType m_stringCache; 91 StringCacheMapTraits::MapType m_stringCache;
92 StringCacheMapTraits::MapType::PersistentValueReference m_lastV8String; 92 StringCacheMapTraits::MapType::PersistentValueReference m_lastV8String;
93 93
94 // Note: RefPtr is a must as we cache by StringImpl* equality, not identity 94 // Note: RefPtr is a must as we cache by StringImpl* equality, not identity
95 // hence lastStringImpl might be not a key of the cache (in sense of identit y) 95 // hence lastStringImpl might be not a key of the cache (in sense of identit y)
96 // and hence it's not refed on addition. 96 // and hence it's not refed on addition.
97 RefPtr<StringImpl> m_lastStringImpl; 97 RefPtr<StringImpl> m_lastStringImpl;
98 }; 98 };
99 99
100 } // namespace blink 100 } // namespace blink
101 101
102 #endif // V8ValueCache_h 102 #endif // V8ValueCache_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8ValueCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698