| OLD | NEW |
| 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" | |
| 11 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 12 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 13 #include "base/logging.h" | 12 #include "base/logging.h" |
| 14 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 15 #include "base/metrics/stats_counters.h" | 14 #include "base/metrics/stats_counters.h" |
| 16 #include "base/process/process.h" | 15 #include "base/process/process.h" |
| 17 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 18 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| (...skipping 3602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3623 FOR_EACH_OBSERVER(WebContentsObserver, | 3622 FOR_EACH_OBSERVER(WebContentsObserver, |
| 3624 observers_, | 3623 observers_, |
| 3625 RenderProcessGone(GetCrashedStatus())); | 3624 RenderProcessGone(GetCrashedStatus())); |
| 3626 } | 3625 } |
| 3627 | 3626 |
| 3628 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { | 3627 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { |
| 3629 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); | 3628 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); |
| 3630 } | 3629 } |
| 3631 | 3630 |
| 3632 void WebContentsImpl::UpdateState(RenderViewHost* rvh, | 3631 void WebContentsImpl::UpdateState(RenderViewHost* rvh, |
| 3633 int32 rvh_page_id, | |
| 3634 int32 page_id, | 3632 int32 page_id, |
| 3635 const PageState& page_state) { | 3633 const PageState& page_state) { |
| 3636 if (rvh_page_id != page_id) { | |
| 3637 base::debug::SetCrashKeyValue("renderer_page_id", | |
| 3638 base::IntToString(page_id)); | |
| 3639 base::debug::SetCrashKeyValue("browser_page_id", | |
| 3640 base::IntToString(rvh_page_id)); | |
| 3641 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( | |
| 3642 controller_.GetLastCommittedEntry()); | |
| 3643 // The question being answered here is: when there is a page id mismatch | |
| 3644 // between the renderer and the browser, which value (if either) matches | |
| 3645 // that of the last committed entry? | |
| 3646 if (entry) { | |
| 3647 if (entry->site_instance() == rvh->GetSiteInstance()) { | |
| 3648 base::debug::SetCrashKeyValue("last_committed_page_id", | |
| 3649 base::IntToString(entry->GetPageID())); | |
| 3650 } else { | |
| 3651 base::debug::SetCrashKeyValue("last_committed_page_id", | |
| 3652 "site instance mismatch"); | |
| 3653 } | |
| 3654 } else { | |
| 3655 base::debug::SetCrashKeyValue("last_committed_page_id", "no entry"); | |
| 3656 } | |
| 3657 // The question being answered here is: when there is a page id mismatch | |
| 3658 // between the renderer and the browser, was the WebContents going to throw | |
| 3659 // out the message anyway? | |
| 3660 if (rvh != GetRenderViewHost() && | |
| 3661 !GetRenderManager()->IsRVHOnSwappedOutList( | |
| 3662 static_cast<RenderViewHostImpl*>(rvh))) { | |
| 3663 base::debug::SetCrashKeyValue("quick_discard", "yes"); | |
| 3664 } else { | |
| 3665 base::debug::SetCrashKeyValue("quick_discard", "no"); | |
| 3666 } | |
| 3667 CHECK(false); | |
| 3668 } | |
| 3669 // Ensure that this state update comes from either the active RVH or one of | 3634 // Ensure that this state update comes from either the active RVH or one of |
| 3670 // the swapped out RVHs. We don't expect to hear from any other RVHs. | 3635 // the swapped out RVHs. We don't expect to hear from any other RVHs. |
| 3671 // TODO(nasko): This should go through RenderFrameHost. | 3636 // TODO(nasko): This should go through RenderFrameHost. |
| 3672 // TODO(creis): We can't update state for cross-process subframes until we | 3637 // TODO(creis): We can't update state for cross-process subframes until we |
| 3673 // have FrameNavigationEntries. Once we do, this should be a DCHECK. | 3638 // have FrameNavigationEntries. Once we do, this should be a DCHECK. |
| 3674 if (rvh != GetRenderViewHost() && | 3639 if (rvh != GetRenderViewHost() && |
| 3675 !GetRenderManager()->IsRVHOnSwappedOutList( | 3640 !GetRenderManager()->IsRVHOnSwappedOutList( |
| 3676 static_cast<RenderViewHostImpl*>(rvh))) | 3641 static_cast<RenderViewHostImpl*>(rvh))) |
| 3677 return; | 3642 return; |
| 3678 | 3643 |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4407 node->render_manager()->ResumeResponseDeferredAtStart(); | 4372 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4408 } | 4373 } |
| 4409 | 4374 |
| 4410 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4375 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4411 force_disable_overscroll_content_ = force_disable; | 4376 force_disable_overscroll_content_ = force_disable; |
| 4412 if (view_) | 4377 if (view_) |
| 4413 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4378 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4414 } | 4379 } |
| 4415 | 4380 |
| 4416 } // namespace content | 4381 } // namespace content |
| OLD | NEW |