1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef WeakNodeMap_h 6 #define WeakNodeMap_h 7 8 #include "wtf/HashMap.h" 9 10 namespace blink { 11 12 // Oilpan supports weak maps, so we no longer need WeakNodeMap. 13 #if !ENABLE(OILPAN) 14 class Node; 15 class NodeToWeakNodeMaps; 16 17 class WeakNodeMap { 18 public: 19 ~WeakNodeMap(); 20 21 void put(Node*, int value); 22 int value(Node*); 23 Node* node(int value); 24 25 private: 26 // FIXME: This should not be friends with Node, we should expose a proper API and not 27 // let the map directly set flags. 28 friend class Node; 29 static void notifyNodeDestroyed(Node*); 30 31 friend class NodeToWeakNodeMaps; 32 void nodeDestroyed(Node*); 33 34 typedef HashMap<Node*, int> NodeToValue; 35 NodeToValue m_nodeToValue; 36 typedef HashMap<int, Node*> ValueToNode; 37 ValueToNode m_valueToNode; 38 }; 39 #endif 40 41 } 42 43 #endif 44