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

Side by Side Diff: content/renderer/history_entry.h

Issue 2705073003: Remove ScopedVector from content/renderer/. (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
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, 2009 Torch Mobile Inc. All rights reserved. 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
8 * (http://www.torchmobile.com/) 8 * (http://www.torchmobile.com/)
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 18 matching lines...) Expand all
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35 #ifndef CONTENT_RENDERER_HISTORY_ENTRY_H_ 35 #ifndef CONTENT_RENDERER_HISTORY_ENTRY_H_
36 #define CONTENT_RENDERER_HISTORY_ENTRY_H_ 36 #define CONTENT_RENDERER_HISTORY_ENTRY_H_
37 37
38 #include <memory> 38 #include <memory>
39 #include <vector>
39 40
40 #include "base/containers/hash_tables.h" 41 #include "base/containers/hash_tables.h"
41 #include "base/memory/scoped_vector.h"
42 #include "base/memory/weak_ptr.h" 42 #include "base/memory/weak_ptr.h"
43 #include "content/common/content_export.h" 43 #include "content/common/content_export.h"
44 #include "third_party/WebKit/public/platform/WebURLRequest.h" 44 #include "third_party/WebKit/public/platform/WebURLRequest.h"
45 #include "third_party/WebKit/public/web/WebHistoryItem.h" 45 #include "third_party/WebKit/public/web/WebHistoryItem.h"
46 46
47 namespace content { 47 namespace content {
48 class RenderFrameImpl; 48 class RenderFrameImpl;
49 class RenderViewImpl; 49 class RenderViewImpl;
50 50
51 class CONTENT_EXPORT HistoryEntry { 51 class CONTENT_EXPORT HistoryEntry {
52 public: 52 public:
53 class HistoryNode { 53 class HistoryNode {
54 public: 54 public:
55 HistoryNode(const base::WeakPtr<HistoryEntry>& entry, 55 HistoryNode(const base::WeakPtr<HistoryEntry>& entry,
56 const blink::WebHistoryItem& item); 56 const blink::WebHistoryItem& item);
57 ~HistoryNode(); 57 ~HistoryNode();
58 58
59 HistoryNode* AddChild(const blink::WebHistoryItem& item); 59 HistoryNode* AddChild(const blink::WebHistoryItem& item);
60 HistoryNode* AddChild(); 60 HistoryNode* AddChild();
61 HistoryNode* CloneAndReplace(const base::WeakPtr<HistoryEntry>& new_entry, 61 std::unique_ptr<HistoryNode> CloneAndReplace(
Avi (use Gerrit) 2017/02/21 16:01:36 👍
62 const blink::WebHistoryItem& new_item, 62 const base::WeakPtr<HistoryEntry>& new_entry,
63 bool clone_children_of_target, 63 const blink::WebHistoryItem& new_item,
64 RenderFrameImpl* target_frame, 64 bool clone_children_of_target,
65 RenderFrameImpl* current_frame); 65 RenderFrameImpl* target_frame,
66 RenderFrameImpl* current_frame);
66 blink::WebHistoryItem& item() { return item_; } 67 blink::WebHistoryItem& item() { return item_; }
67 void set_item(const blink::WebHistoryItem& item); 68 void set_item(const blink::WebHistoryItem& item);
68 std::vector<HistoryNode*>& children() const { return children_->get(); } 69 std::vector<HistoryNode*> children() const;
69 void RemoveChildren(); 70 void RemoveChildren();
70 71
71 private: 72 private:
72 // When a HistoryEntry is destroyed, it takes all its HistoryNodes with it. 73 // When a HistoryEntry is destroyed, it takes all its HistoryNodes with it.
73 // Use a WeakPtr to ensure that HistoryNodes don't try to illegally access 74 // Use a WeakPtr to ensure that HistoryNodes don't try to illegally access
74 // a dying HistoryEntry, or do unnecessary work when the whole entry is 75 // a dying HistoryEntry, or do unnecessary work when the whole entry is
75 // being destroyed. 76 // being destroyed.
76 base::WeakPtr<HistoryEntry> entry_; 77 base::WeakPtr<HistoryEntry> entry_;
77 std::unique_ptr<ScopedVector<HistoryNode>> children_; 78 std::vector<std::unique_ptr<HistoryNode>> children_;
78 blink::WebHistoryItem item_; 79 blink::WebHistoryItem item_;
79 // We need to track multiple names because the name of a frame can change 80 // We need to track multiple names because the name of a frame can change
80 // over its lifetime. This allows us to clean up all of the names this node 81 // over its lifetime. This allows us to clean up all of the names this node
81 // has ever known by when it is destroyed. 82 // has ever known by when it is destroyed.
82 std::vector<std::string> unique_names_; 83 std::vector<std::string> unique_names_;
83 }; 84 };
84 85
85 HistoryEntry(const blink::WebHistoryItem& root); 86 HistoryEntry(const blink::WebHistoryItem& root);
86 HistoryEntry(); 87 HistoryEntry();
87 ~HistoryEntry(); 88 ~HistoryEntry();
(...skipping 13 matching lines...) Expand all
101 102
102 typedef base::hash_map<std::string, HistoryNode*> UniqueNamesToItems; 103 typedef base::hash_map<std::string, HistoryNode*> UniqueNamesToItems;
103 UniqueNamesToItems unique_names_to_items_; 104 UniqueNamesToItems unique_names_to_items_;
104 105
105 base::WeakPtrFactory<HistoryEntry> weak_ptr_factory_; 106 base::WeakPtrFactory<HistoryEntry> weak_ptr_factory_;
106 }; 107 };
107 108
108 } // namespace content 109 } // namespace content
109 110
110 #endif // CONTENT_RENDERER_HISTORY_ENTRY_H_ 111 #endif // CONTENT_RENDERER_HISTORY_ENTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698