OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/browser/frame_host/navigation_entry_impl.h" | 5 #include "content/browser/frame_host/navigation_entry_impl.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 const GURL& url, | 540 const GURL& url, |
541 const Referrer& referrer, | 541 const Referrer& referrer, |
542 const PageState& page_state) { | 542 const PageState& page_state) { |
543 // We should already have a TreeNode for the parent node by the time this node | 543 // We should already have a TreeNode for the parent node by the time this node |
544 // commits. Find it first. | 544 // commits. Find it first. |
545 DCHECK(frame_tree_node->parent()); | 545 DCHECK(frame_tree_node->parent()); |
546 NavigationEntryImpl::TreeNode* parent_node = | 546 NavigationEntryImpl::TreeNode* parent_node = |
547 FindFrameEntry(frame_tree_node->parent()); | 547 FindFrameEntry(frame_tree_node->parent()); |
548 if (!parent_node) { | 548 if (!parent_node) { |
549 // The renderer should not send a commit for a subframe before its parent. | 549 // The renderer should not send a commit for a subframe before its parent. |
550 // TODO(creis): Kill the renderer if we get here. For now, crash to | 550 // TODO(creis): Kill the renderer if we get here. |
551 // diagnose https://crbug.com/522193, since we most likely fail here when | 551 return; |
552 // creating the first subframe entry before the CloneAndReplace call fails. | |
553 CHECK(false) << "Shouldn't see a commit for a subframe before parent."; | |
554 } | 552 } |
555 | 553 |
556 // Now check whether we have a TreeNode for the node itself. | 554 // Now check whether we have a TreeNode for the node itself. |
557 int frame_tree_node_id = frame_tree_node->frame_tree_node_id(); | 555 int frame_tree_node_id = frame_tree_node->frame_tree_node_id(); |
558 for (TreeNode* child : parent_node->children) { | 556 for (TreeNode* child : parent_node->children) { |
559 if (child->frame_entry->frame_tree_node_id() == frame_tree_node_id) { | 557 if (child->frame_entry->frame_tree_node_id() == frame_tree_node_id) { |
560 // Update the existing FrameNavigationEntry (e.g., for replaceState). | 558 // Update the existing FrameNavigationEntry (e.g., for replaceState). |
561 child->frame_entry->UpdateEntry(item_sequence_number, | 559 child->frame_entry->UpdateEntry(item_sequence_number, |
562 document_sequence_number, site_instance, | 560 document_sequence_number, site_instance, |
563 url, referrer, page_state); | 561 url, referrer, page_state); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 return node; | 606 return node; |
609 } | 607 } |
610 // Enqueue any children and keep looking. | 608 // Enqueue any children and keep looking. |
611 for (auto& child : node->children) | 609 for (auto& child : node->children) |
612 work_queue.push(child); | 610 work_queue.push(child); |
613 } | 611 } |
614 return nullptr; | 612 return nullptr; |
615 } | 613 } |
616 | 614 |
617 } // namespace content | 615 } // namespace content |
OLD | NEW |