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

Unified Diff: src/debug.h

Issue 1145183004: Debugger: use weak cells to implement ScriptCache. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.h
diff --git a/src/debug.h b/src/debug.h
index 9a9a3ba9239d035b69ed1e6e9c05442cfa0c2259..fcea2bdfdb8b27a8716f2a211d5515c82ed7d17b 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -228,31 +228,22 @@ class BreakLocation {
// to it is created and that weak handle is stored in the cache. The weak handle
// callback takes care of removing the script from the cache. The key used in
// the cache is the script id.
-class ScriptCache : private HashMap {
+class ScriptCache {
public:
explicit ScriptCache(Isolate* isolate);
- virtual ~ScriptCache() { Clear(); }
+ ~ScriptCache();
// Add script to the cache.
void Add(Handle<Script> script);
// Return the scripts in the cache.
- Handle<FixedArray> GetScripts();
-
- private:
- // Calculate the hash value from the key (script id).
- static uint32_t Hash(int key) {
- return ComputeIntegerHash(key, v8::internal::kZeroHashSeed);
+ Handle<FixedArray> GetScripts() {
+ return WeakValueHashTable::GetWeakValues(table_);
}
- // Clear the cache releasing all the weak handles.
- void Clear();
-
- // Weak handle callback for scripts in the cache.
- static void HandleWeakScript(
- const v8::WeakCallbackData<v8::Value, void>& data);
-
+ private:
Isolate* isolate_;
+ Handle<WeakValueHashTable> table_;
};
« no previous file with comments | « no previous file | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698