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

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

Issue 2114213002: Fix loading placeholders for Lo-Fi (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 if (common_params.referrer.url.is_valid()) { 529 if (common_params.referrer.url.is_valid()) {
530 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader( 530 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader(
531 common_params.referrer.policy, 531 common_params.referrer.policy,
532 common_params.url, 532 common_params.url,
533 WebString::fromUTF8(common_params.referrer.url.spec())); 533 WebString::fromUTF8(common_params.referrer.url.spec()));
534 if (!web_referrer.isEmpty()) 534 if (!web_referrer.isEmpty())
535 request.setHTTPReferrer(web_referrer, common_params.referrer.policy); 535 request.setHTTPReferrer(web_referrer, common_params.referrer.policy);
536 } 536 }
537 537
538 request.setHTTPMethod(WebString::fromUTF8(common_params.method)); 538 request.setHTTPMethod(WebString::fromUTF8(common_params.method));
539 request.setLoFiState(
540 static_cast<WebURLRequest::LoFiState>(common_params.lofi_state));
539 541
540 RequestExtraData* extra_data = new RequestExtraData(); 542 RequestExtraData* extra_data = new RequestExtraData();
541 extra_data->set_stream_override(std::move(stream_override)); 543 extra_data->set_stream_override(std::move(stream_override));
542 extra_data->set_lofi_state(common_params.lofi_state);
543 request.setExtraData(extra_data); 544 request.setExtraData(extra_data);
544 545
545 // Set the ui timestamp for this navigation. Currently the timestamp here is 546 // Set the ui timestamp for this navigation. Currently the timestamp here is
546 // only non empty when the navigation was triggered by an Android intent. The 547 // only non empty when the navigation was triggered by an Android intent. The
547 // timestamp is converted to a double version supported by blink. It will be 548 // timestamp is converted to a double version supported by blink. It will be
548 // passed back to the browser in the DidCommitProvisionalLoad and the 549 // passed back to the browser in the DidCommitProvisionalLoad and the
549 // DocumentLoadComplete IPCs. 550 // DocumentLoadComplete IPCs.
550 base::TimeDelta ui_timestamp = common_params.ui_timestamp - base::TimeTicks(); 551 base::TimeDelta ui_timestamp = common_params.ui_timestamp - base::TimeTicks();
551 request.setUiStartTime(ui_timestamp.InSecondsF()); 552 request.setUiStartTime(ui_timestamp.InSecondsF());
552 request.setInputPerfMetricReportPolicy( 553 request.setInputPerfMetricReportPolicy(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 FrameMsg_UILoadMetricsReportType::Value report_type = 605 FrameMsg_UILoadMetricsReportType::Value report_type =
605 static_cast<FrameMsg_UILoadMetricsReportType::Value>( 606 static_cast<FrameMsg_UILoadMetricsReportType::Value>(
606 request->inputPerfMetricReportPolicy()); 607 request->inputPerfMetricReportPolicy());
607 608
608 const RequestExtraData* extra_data = 609 const RequestExtraData* extra_data =
609 static_cast<RequestExtraData*>(request->getExtraData()); 610 static_cast<RequestExtraData*>(request->getExtraData());
610 DCHECK(extra_data); 611 DCHECK(extra_data);
611 return CommonNavigationParams( 612 return CommonNavigationParams(
612 request->url(), referrer, extra_data->transition_type(), 613 request->url(), referrer, extra_data->transition_type(),
613 FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry, 614 FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry,
614 ui_timestamp, report_type, GURL(), GURL(), extra_data->lofi_state(), 615 ui_timestamp, report_type, GURL(), GURL(),
615 base::TimeTicks::Now(), request->httpMethod().latin1(), 616 static_cast<LoFiState>(request->getLoFiState()), base::TimeTicks::Now(),
616 GetRequestBodyForWebURLRequest(*request)); 617 request->httpMethod().latin1(), GetRequestBodyForWebURLRequest(*request));
617 } 618 }
618 619
619 media::Context3D GetSharedMainThreadContext3D( 620 media::Context3D GetSharedMainThreadContext3D(
620 scoped_refptr<ContextProviderCommandBuffer> provider) { 621 scoped_refptr<ContextProviderCommandBuffer> provider) {
621 if (!provider) 622 if (!provider)
622 return media::Context3D(); 623 return media::Context3D();
623 return media::Context3D(provider->ContextGL(), provider->GrContext()); 624 return media::Context3D(provider->ContextGL(), provider->GrContext());
624 } 625 }
625 626
626 bool IsReload(FrameMsg_Navigate_Type::Value navigation_type) { 627 bool IsReload(FrameMsg_Navigate_Type::Value navigation_type) {
(...skipping 3423 matching lines...) Expand 10 before | Expand all | Expand 10 after
4050 extra_data->set_allow_download( 4051 extra_data->set_allow_download(
4051 navigation_state->common_params().allow_download); 4052 navigation_state->common_params().allow_download);
4052 extra_data->set_transition_type(transition_type); 4053 extra_data->set_transition_type(transition_type);
4053 extra_data->set_should_replace_current_entry(should_replace_current_entry); 4054 extra_data->set_should_replace_current_entry(should_replace_current_entry);
4054 extra_data->set_transferred_request_child_id( 4055 extra_data->set_transferred_request_child_id(
4055 navigation_state->start_params().transferred_request_child_id); 4056 navigation_state->start_params().transferred_request_child_id);
4056 extra_data->set_transferred_request_request_id( 4057 extra_data->set_transferred_request_request_id(
4057 navigation_state->start_params().transferred_request_request_id); 4058 navigation_state->start_params().transferred_request_request_id);
4058 extra_data->set_service_worker_provider_id(provider_id); 4059 extra_data->set_service_worker_provider_id(provider_id);
4059 extra_data->set_stream_override(std::move(stream_override)); 4060 extra_data->set_stream_override(std::move(stream_override));
4060 if (request.getLoFiState() != WebURLRequest::LoFiUnspecified)
4061 extra_data->set_lofi_state(static_cast<LoFiState>(request.getLoFiState()));
4062 else if (is_main_frame_ && !navigation_state->request_committed())
4063 extra_data->set_lofi_state(navigation_state->common_params().lofi_state);
4064 else
4065 extra_data->set_lofi_state(is_using_lofi_ ? LOFI_ON : LOFI_OFF);
4066 WebString error; 4061 WebString error;
4067 extra_data->set_initiated_in_secure_context( 4062 extra_data->set_initiated_in_secure_context(
4068 frame->document().isSecureContext(error)); 4063 frame->document().isSecureContext(error));
4069 request.setExtraData(extra_data); 4064 request.setExtraData(extra_data);
4070 4065
4066 if (request.getLoFiState() == WebURLRequest::LoFiUnspecified) {
4067 if (is_main_frame_ && !navigation_state->request_committed()) {
4068 request.setLoFiState(static_cast<WebURLRequest::LoFiState>(
4069 navigation_state->common_params().lofi_state));
4070 } else {
4071 request.setLoFiState(static_cast<WebURLRequest::LoFiState>(
4072 is_using_lofi_ ? LOFI_ON : LOFI_OFF));
4073 }
4074 }
4075
4071 // TODO(creis): Update prefetching to work with out-of-process iframes. 4076 // TODO(creis): Update prefetching to work with out-of-process iframes.
4072 WebFrame* top_frame = frame->top(); 4077 WebFrame* top_frame = frame->top();
4073 if (top_frame && top_frame->isWebLocalFrame()) { 4078 if (top_frame && top_frame->isWebLocalFrame()) {
4074 DocumentState* top_document_state = 4079 DocumentState* top_document_state =
4075 DocumentState::FromDataSource(top_frame->dataSource()); 4080 DocumentState::FromDataSource(top_frame->dataSource());
4076 if (top_document_state) { 4081 if (top_document_state) {
4077 // TODO(gavinp): separate out prefetching and prerender field trials 4082 // TODO(gavinp): separate out prefetching and prerender field trials
4078 // if the rel=prerender rel type is sticking around. 4083 // if the rel=prerender rel type is sticking around.
4079 if (request.getRequestContext() == WebURLRequest::RequestContextPrefetch) 4084 if (request.getRequestContext() == WebURLRequest::RequestContextPrefetch)
4080 top_document_state->set_was_prefetcher(true); 4085 top_document_state->set_was_prefetcher(true);
(...skipping 2247 matching lines...) Expand 10 before | Expand all | Expand 10 after
6328 // event target. Potentially a Pepper plugin will receive the event. 6333 // event target. Potentially a Pepper plugin will receive the event.
6329 // In order to tell whether a plugin gets the last mouse event and which it 6334 // In order to tell whether a plugin gets the last mouse event and which it
6330 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6335 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6331 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6336 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6332 // |pepper_last_mouse_event_target_|. 6337 // |pepper_last_mouse_event_target_|.
6333 pepper_last_mouse_event_target_ = nullptr; 6338 pepper_last_mouse_event_target_ = nullptr;
6334 #endif 6339 #endif
6335 } 6340 }
6336 6341
6337 } // namespace content 6342 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698