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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1421483005: Reland: Remove DCHECK_IMPLIES/CHECK_IMPLIES. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 2 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 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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 CHECK(proxy); 620 CHECK(proxy);
621 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id); 621 render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id);
622 web_frame = 622 web_frame =
623 blink::WebLocalFrame::create(replicated_state.scope, render_frame); 623 blink::WebLocalFrame::create(replicated_state.scope, render_frame);
624 render_frame->proxy_routing_id_ = proxy_routing_id; 624 render_frame->proxy_routing_id_ = proxy_routing_id;
625 web_frame->initializeToReplaceRemoteFrame( 625 web_frame->initializeToReplaceRemoteFrame(
626 proxy->web_frame(), WebString::fromUTF8(replicated_state.name), 626 proxy->web_frame(), WebString::fromUTF8(replicated_state.name),
627 replicated_state.sandbox_flags); 627 replicated_state.sandbox_flags);
628 } 628 }
629 render_frame->SetWebFrame(web_frame); 629 render_frame->SetWebFrame(web_frame);
630 CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent()); 630 CHECK(parent_routing_id != MSG_ROUTING_NONE || !web_frame->parent());
631 631
632 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr); 632 WebFrame* opener = ResolveOpener(opener_routing_id, nullptr);
633 web_frame->setOpener(opener); 633 web_frame->setOpener(opener);
634 634
635 if (widget_params.routing_id != MSG_ROUTING_NONE) { 635 if (widget_params.routing_id != MSG_ROUTING_NONE) {
636 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); 636 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
637 render_frame->render_widget_ = RenderWidget::CreateForFrame( 637 render_frame->render_widget_ = RenderWidget::CreateForFrame(
638 widget_params.routing_id, widget_params.hidden, 638 widget_params.routing_id, widget_params.hidden,
639 render_frame->render_view_->screen_info(), compositor_deps, web_frame); 639 render_frame->render_view_->screen_info(), compositor_deps, web_frame);
640 // TODO(kenrb): Observing shouldn't be necessary when we sort out 640 // TODO(kenrb): Observing shouldn't be necessary when we sort out
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 void RenderFrameImpl::OnSwapOut( 1226 void RenderFrameImpl::OnSwapOut(
1227 int proxy_routing_id, 1227 int proxy_routing_id,
1228 bool is_loading, 1228 bool is_loading,
1229 const FrameReplicationState& replicated_frame_state) { 1229 const FrameReplicationState& replicated_frame_state) {
1230 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_); 1230 TRACE_EVENT1("navigation", "RenderFrameImpl::OnSwapOut", "id", routing_id_);
1231 RenderFrameProxy* proxy = NULL; 1231 RenderFrameProxy* proxy = NULL;
1232 bool swapped_out_forbidden = 1232 bool swapped_out_forbidden =
1233 SiteIsolationPolicy::IsSwappedOutStateForbidden(); 1233 SiteIsolationPolicy::IsSwappedOutStateForbidden();
1234 1234
1235 // This codepath should only be hit for subframes when in --site-per-process. 1235 // This codepath should only be hit for subframes when in --site-per-process.
1236 CHECK_IMPLIES(!is_main_frame_, 1236 CHECK(is_main_frame_ || SiteIsolationPolicy::AreCrossProcessFramesPossible());
1237 SiteIsolationPolicy::AreCrossProcessFramesPossible());
1238 1237
1239 // Only run unload if we're not swapped out yet, but send the ack either way. 1238 // Only run unload if we're not swapped out yet, but send the ack either way.
1240 if (!is_swapped_out_) { 1239 if (!is_swapped_out_) {
1241 // Swap this RenderFrame out so the frame can navigate to a page rendered by 1240 // Swap this RenderFrame out so the frame can navigate to a page rendered by
1242 // a different process. This involves running the unload handler and 1241 // a different process. This involves running the unload handler and
1243 // clearing the page. We also allow this process to exit if there are no 1242 // clearing the page. We also allow this process to exit if there are no
1244 // other active RenderFrames in it. 1243 // other active RenderFrames in it.
1245 1244
1246 // Send an UpdateState message before we get swapped out. 1245 // Send an UpdateState message before we get swapped out.
1247 render_view_->SendUpdateState(); 1246 render_view_->SendUpdateState();
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
2647 // callback is invoked. 2646 // callback is invoked.
2648 if (!ds) 2647 if (!ds)
2649 return; 2648 return;
2650 2649
2651 TRACE_EVENT2("navigation,benchmark", 2650 TRACE_EVENT2("navigation,benchmark",
2652 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, 2651 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_,
2653 "url", ds->request().url().string().utf8()); 2652 "url", ds->request().url().string().utf8());
2654 DocumentState* document_state = DocumentState::FromDataSource(ds); 2653 DocumentState* document_state = DocumentState::FromDataSource(ds);
2655 2654
2656 // We should only navigate to swappedout:// when is_swapped_out_ is true. 2655 // We should only navigate to swappedout:// when is_swapped_out_ is true.
2657 CHECK_IMPLIES(ds->request().url() == GURL(kSwappedOutURL), is_swapped_out_) 2656 CHECK(ds->request().url() != GURL(kSwappedOutURL) || is_swapped_out_)
2658 << "Heard swappedout:// when not swapped out."; 2657 << "Heard swappedout:// when not swapped out.";
2659 2658
2660 // Update the request time if WebKit has better knowledge of it. 2659 // Update the request time if WebKit has better knowledge of it.
2661 if (document_state->request_time().is_null() && 2660 if (document_state->request_time().is_null() &&
2662 triggering_event_time != 0.0) { 2661 triggering_event_time != 0.0) {
2663 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); 2662 document_state->set_request_time(Time::FromDoubleT(triggering_event_time));
2664 } 2663 }
2665 2664
2666 // Start time is only set after request time. 2665 // Start time is only set after request time.
2667 document_state->set_start_load_time(Time::Now()); 2666 document_state->set_start_load_time(Time::Now());
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
2813 if (is_new_navigation) { 2812 if (is_new_navigation) {
2814 // We bump our Page ID to correspond with the new session history entry. 2813 // We bump our Page ID to correspond with the new session history entry.
2815 render_view_->page_id_ = render_view_->next_page_id_++; 2814 render_view_->page_id_ = render_view_->next_page_id_++;
2816 2815
2817 // Don't update history list values for kSwappedOutURL, since 2816 // Don't update history list values for kSwappedOutURL, since
2818 // we don't want to forget the entry that was there, and since we will 2817 // we don't want to forget the entry that was there, and since we will
2819 // never come back to kSwappedOutURL. Note that we have to call 2818 // never come back to kSwappedOutURL. Note that we have to call
2820 // SendUpdateState and update page_id_ even in this case, so that 2819 // SendUpdateState and update page_id_ even in this case, so that
2821 // the current entry gets a state update and so that we don't send a 2820 // the current entry gets a state update and so that we don't send a
2822 // state update to the wrong entry when we swap back in. 2821 // state update to the wrong entry when we swap back in.
2823 DCHECK_IMPLIES( 2822 DCHECK(!navigation_state->common_params().should_replace_current_entry ||
2824 navigation_state->common_params().should_replace_current_entry, 2823 render_view_->history_list_length_ > 0);
2825 render_view_->history_list_length_ > 0);
2826 if (GetLoadingUrl() != GURL(kSwappedOutURL) && 2824 if (GetLoadingUrl() != GURL(kSwappedOutURL) &&
2827 !navigation_state->common_params().should_replace_current_entry) { 2825 !navigation_state->common_params().should_replace_current_entry) {
2828 // Advance our offset in session history, applying the length limit. 2826 // Advance our offset in session history, applying the length limit.
2829 // There is now no forward history. 2827 // There is now no forward history.
2830 render_view_->history_list_offset_++; 2828 render_view_->history_list_offset_++;
2831 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries) 2829 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries)
2832 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1; 2830 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1;
2833 render_view_->history_list_length_ = 2831 render_view_->history_list_length_ =
2834 render_view_->history_list_offset_ + 1; 2832 render_view_->history_list_offset_ + 1;
2835 } 2833 }
(...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after
4969 } 4967 }
4970 4968
4971 // These values are assumed on the browser side for navigations. These checks 4969 // These values are assumed on the browser side for navigations. These checks
4972 // ensure the renderer has the correct values. 4970 // ensure the renderer has the correct values.
4973 DCHECK_EQ(FETCH_REQUEST_MODE_SAME_ORIGIN, 4971 DCHECK_EQ(FETCH_REQUEST_MODE_SAME_ORIGIN,
4974 GetFetchRequestModeForWebURLRequest(*request)); 4972 GetFetchRequestModeForWebURLRequest(*request));
4975 DCHECK_EQ(FETCH_CREDENTIALS_MODE_INCLUDE, 4973 DCHECK_EQ(FETCH_CREDENTIALS_MODE_INCLUDE,
4976 GetFetchCredentialsModeForWebURLRequest(*request)); 4974 GetFetchCredentialsModeForWebURLRequest(*request));
4977 DCHECK(GetFetchRedirectModeForWebURLRequest(*request) == 4975 DCHECK(GetFetchRedirectModeForWebURLRequest(*request) ==
4978 FetchRedirectMode::MANUAL_MODE); 4976 FetchRedirectMode::MANUAL_MODE);
4979 DCHECK_IMPLIES(!frame_->parent(), 4977 DCHECK(frame_->parent() ||
4980 GetRequestContextFrameTypeForWebURLRequest(*request) == 4978 GetRequestContextFrameTypeForWebURLRequest(*request) ==
4981 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL); 4979 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL);
4982 DCHECK_IMPLIES(frame_->parent(), 4980 DCHECK(!frame_->parent() ||
4983 GetRequestContextFrameTypeForWebURLRequest(*request) == 4981 GetRequestContextFrameTypeForWebURLRequest(*request) ==
4984 REQUEST_CONTEXT_FRAME_TYPE_NESTED); 4982 REQUEST_CONTEXT_FRAME_TYPE_NESTED);
4985 4983
4986 Send(new FrameHostMsg_BeginNavigation( 4984 Send(new FrameHostMsg_BeginNavigation(
4987 routing_id_, 4985 routing_id_,
4988 MakeCommonNavigationParams(request, should_replace_current_entry), 4986 MakeCommonNavigationParams(request, should_replace_current_entry),
4989 BeginNavigationParams( 4987 BeginNavigationParams(
4990 request->httpMethod().latin1(), GetWebURLRequestHeaders(*request), 4988 request->httpMethod().latin1(), GetWebURLRequestHeaders(*request),
4991 GetLoadFlagsForWebURLRequest(*request), request->hasUserGesture(), 4989 GetLoadFlagsForWebURLRequest(*request), request->hasUserGesture(),
4992 request->skipServiceWorker(), 4990 request->skipServiceWorker(),
4993 GetRequestContextTypeForWebURLRequest(*request)), 4991 GetRequestContextTypeForWebURLRequest(*request)),
4994 GetRequestBodyForWebURLRequest(*request))); 4992 GetRequestBodyForWebURLRequest(*request)));
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
5251 mojo::ServiceProviderPtr service_provider; 5249 mojo::ServiceProviderPtr service_provider;
5252 mojo::URLRequestPtr request(mojo::URLRequest::New()); 5250 mojo::URLRequestPtr request(mojo::URLRequest::New());
5253 request->url = mojo::String::From(url); 5251 request->url = mojo::String::From(url);
5254 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), 5252 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider),
5255 nullptr, nullptr, 5253 nullptr, nullptr,
5256 base::Bind(&OnGotContentHandlerID)); 5254 base::Bind(&OnGotContentHandlerID));
5257 return service_provider.Pass(); 5255 return service_provider.Pass();
5258 } 5256 }
5259 5257
5260 } // namespace content 5258 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698