| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /* | 5 /* |
| 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * | 10 * |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Frame routing ids are not safe to serialize, so instead create a mapping | 47 // Frame routing ids are not safe to serialize, so instead create a mapping |
| 48 // from routing ids to frame sequence numbers. The sequence numbers can be | 48 // from routing ids to frame sequence numbers. The sequence numbers can be |
| 49 // benignly serialized with limited risk of collision in a different process. | 49 // benignly serialized with limited risk of collision in a different process. |
| 50 // FrameMap is a singleton per-process. | 50 // FrameMap is a singleton per-process. |
| 51 typedef base::hash_map<uint64_t, uint64_t> FrameMap; | 51 typedef base::hash_map<uint64_t, uint64_t> FrameMap; |
| 52 static FrameMap& GetFrameMap() { | 52 static FrameMap& GetFrameMap() { |
| 53 CR_DEFINE_STATIC_LOCAL(FrameMap, routing_ids_to_internal_frame_ids, ()); | 53 CR_DEFINE_STATIC_LOCAL(FrameMap, routing_ids_to_internal_frame_ids, ()); |
| 54 return routing_ids_to_internal_frame_ids; | 54 return routing_ids_to_internal_frame_ids; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // static |
| 58 void HistoryEntry::UpdateFrameMap(uint64_t old_routing_id, |
| 59 uint64_t new_routing_id) { |
| 60 if (GetFrameMap()[old_routing_id]) { |
| 61 GetFrameMap()[new_routing_id] = GetFrameMap()[old_routing_id]; |
| 62 GetFrameMap().erase(old_routing_id); |
| 63 } |
| 64 } |
| 65 |
| 57 HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::AddChild( | 66 HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::AddChild( |
| 58 const WebHistoryItem& item, | 67 const WebHistoryItem& item, |
| 59 int64_t frame_id) { | 68 int64_t frame_id) { |
| 60 children_->push_back(new HistoryNode(entry_, item, frame_id)); | 69 children_->push_back(new HistoryNode(entry_, item, frame_id)); |
| 61 return children_->back(); | 70 return children_->back(); |
| 62 } | 71 } |
| 63 | 72 |
| 64 HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::AddChild() { | 73 HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::AddChild() { |
| 65 return AddChild(WebHistoryItem(), kInvalidFrameRoutingID); | 74 return AddChild(WebHistoryItem(), kInvalidFrameRoutingID); |
| 66 } | 75 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 return unique_names_to_items_[frame->GetWebFrame()->uniqueName().utf8()]; | 215 return unique_names_to_items_[frame->GetWebFrame()->uniqueName().utf8()]; |
| 207 } | 216 } |
| 208 | 217 |
| 209 WebHistoryItem HistoryEntry::GetItemForFrame(RenderFrameImpl* frame) { | 218 WebHistoryItem HistoryEntry::GetItemForFrame(RenderFrameImpl* frame) { |
| 210 if (HistoryNode* history_node = GetHistoryNodeForFrame(frame)) | 219 if (HistoryNode* history_node = GetHistoryNodeForFrame(frame)) |
| 211 return history_node->item(); | 220 return history_node->item(); |
| 212 return WebHistoryItem(); | 221 return WebHistoryItem(); |
| 213 } | 222 } |
| 214 | 223 |
| 215 } // namespace content | 224 } // namespace content |
| OLD | NEW |