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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 795233002: Ensure that the browser’s copy of page id is in sync with the renderer’s. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/crash_logging.h"
10 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
11 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
14 #include "base/metrics/stats_counters.h" 15 #include "base/metrics/stats_counters.h"
15 #include "base/process/process.h" 16 #include "base/process/process.h"
16 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
17 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
19 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
(...skipping 3577 matching lines...) Expand 10 before | Expand all | Expand 10 after
3597 FOR_EACH_OBSERVER(WebContentsObserver, 3598 FOR_EACH_OBSERVER(WebContentsObserver,
3598 observers_, 3599 observers_,
3599 RenderProcessGone(GetCrashedStatus())); 3600 RenderProcessGone(GetCrashedStatus()));
3600 } 3601 }
3601 3602
3602 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { 3603 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) {
3603 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); 3604 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh));
3604 } 3605 }
3605 3606
3606 void WebContentsImpl::UpdateState(RenderViewHost* rvh, 3607 void WebContentsImpl::UpdateState(RenderViewHost* rvh,
3608 int32 rvh_page_id,
3607 int32 page_id, 3609 int32 page_id,
3608 const PageState& page_state) { 3610 const PageState& page_state) {
3611 if (rvh_page_id != page_id) {
3612 base::debug::SetCrashKeyValue("renderer_page_id",
3613 base::IntToString(page_id));
3614 base::debug::SetCrashKeyValue("browser_page_id",
3615 base::IntToString(rvh_page_id));
3616 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
3617 controller_.GetLastCommittedEntry());
3618 // The question being answered here is: when there is a page id mismatch
3619 // between the renderer and the browser, which value (if either) matches
3620 // that of the last committed entry?
3621 if (entry) {
3622 if (entry->site_instance() == rvh->GetSiteInstance()) {
3623 base::debug::SetCrashKeyValue("last_committed_page_id",
3624 base::IntToString(entry->GetPageID()));
3625 } else {
3626 base::debug::SetCrashKeyValue("last_committed_page_id",
3627 "site instance mismatch");
3628 }
3629 } else {
3630 base::debug::SetCrashKeyValue("last_committed_page_id", "no entry");
3631 }
3632 CHECK(false);
3633 }
3634
3609 // Ensure that this state update comes from a RenderViewHost that belongs to 3635 // Ensure that this state update comes from a RenderViewHost that belongs to
3610 // this WebContents. 3636 // this WebContents.
3611 // TODO(nasko): This should go through RenderFrameHost. 3637 // TODO(nasko): This should go through RenderFrameHost.
3612 // TODO(creis): We can't update state for cross-process subframes until we 3638 // TODO(creis): We can't update state for cross-process subframes until we
3613 // have FrameNavigationEntries. Once we do, this should be a DCHECK. 3639 // have FrameNavigationEntries. Once we do, this should be a DCHECK.
3614 if (rvh->GetDelegate()->GetAsWebContents() != this) 3640 if (rvh->GetDelegate()->GetAsWebContents() != this)
3615 return; 3641 return;
3616 3642
3617 // We must be prepared to handle state updates for any page, these occur 3643 // We must be prepared to handle state updates for any page, these occur
3618 // when the user is scrolling and entering form data, as well as when we're 3644 // when the user is scrolling and entering form data, as well as when we're
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
4355 node->render_manager()->ResumeResponseDeferredAtStart(); 4381 node->render_manager()->ResumeResponseDeferredAtStart();
4356 } 4382 }
4357 4383
4358 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4384 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4359 force_disable_overscroll_content_ = force_disable; 4385 force_disable_overscroll_content_ = force_disable;
4360 if (view_) 4386 if (view_)
4361 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4387 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4362 } 4388 }
4363 4389
4364 } // namespace content 4390 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698