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

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

Issue 2910783002: Adds Lo-Fi fallback support for new Data Reduction Proxy protocol. (Closed)
Patch Set: Makes SlowConnection integration test more permissive in which type of server optimization response… Created 3 years, 6 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 #include "content/renderer/media/media_stream_dispatcher.h" 124 #include "content/renderer/media/media_stream_dispatcher.h"
125 #include "content/renderer/media/user_media_client_impl.h" 125 #include "content/renderer/media/user_media_client_impl.h"
126 #include "content/renderer/mojo/blink_connector_js_wrapper.h" 126 #include "content/renderer/mojo/blink_connector_js_wrapper.h"
127 #include "content/renderer/mojo/blink_interface_registry_impl.h" 127 #include "content/renderer/mojo/blink_interface_registry_impl.h"
128 #include "content/renderer/mojo/interface_provider_js_wrapper.h" 128 #include "content/renderer/mojo/interface_provider_js_wrapper.h"
129 #include "content/renderer/mojo_bindings_controller.h" 129 #include "content/renderer/mojo_bindings_controller.h"
130 #include "content/renderer/navigation_state_impl.h" 130 #include "content/renderer/navigation_state_impl.h"
131 #include "content/renderer/pepper/pepper_audio_controller.h" 131 #include "content/renderer/pepper/pepper_audio_controller.h"
132 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" 132 #include "content/renderer/pepper/plugin_instance_throttler_impl.h"
133 #include "content/renderer/presentation/presentation_dispatcher.h" 133 #include "content/renderer/presentation/presentation_dispatcher.h"
134 #include "content/renderer/previews_state_helper.h"
134 #include "content/renderer/push_messaging/push_messaging_client.h" 135 #include "content/renderer/push_messaging/push_messaging_client.h"
135 #include "content/renderer/render_frame_proxy.h" 136 #include "content/renderer/render_frame_proxy.h"
136 #include "content/renderer/render_process.h" 137 #include "content/renderer/render_process.h"
137 #include "content/renderer/render_thread_impl.h" 138 #include "content/renderer/render_thread_impl.h"
138 #include "content/renderer/render_view_impl.h" 139 #include "content/renderer/render_view_impl.h"
139 #include "content/renderer/render_widget_fullscreen_pepper.h" 140 #include "content/renderer/render_widget_fullscreen_pepper.h"
140 #include "content/renderer/renderer_blink_platform_impl.h" 141 #include "content/renderer/renderer_blink_platform_impl.h"
141 #include "content/renderer/renderer_webapplicationcachehost_impl.h" 142 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
142 #include "content/renderer/renderer_webcolorchooser_impl.h" 143 #include "content/renderer/renderer_webcolorchooser_impl.h"
143 #include "content/renderer/savable_resources.h" 144 #include "content/renderer/savable_resources.h"
(...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after
3576 DocumentState::FromDataSource(frame_->DataSource()); 3577 DocumentState::FromDataSource(frame_->DataSource());
3577 NavigationStateImpl* navigation_state = 3578 NavigationStateImpl* navigation_state =
3578 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 3579 static_cast<NavigationStateImpl*>(document_state->navigation_state());
3579 const WebURLResponse& web_url_response = frame_->DataSource()->GetResponse(); 3580 const WebURLResponse& web_url_response = frame_->DataSource()->GetResponse();
3580 WebURLResponseExtraDataImpl* extra_data = 3581 WebURLResponseExtraDataImpl* extra_data =
3581 GetExtraDataFromResponse(web_url_response); 3582 GetExtraDataFromResponse(web_url_response);
3582 // Only update the PreviewsState and effective connection type states for new 3583 // Only update the PreviewsState and effective connection type states for new
3583 // main frame documents. Subframes inherit from the main frame and should not 3584 // main frame documents. Subframes inherit from the main frame and should not
3584 // change at commit time. 3585 // change at commit time.
3585 if (is_main_frame_ && !navigation_state->WasWithinSameDocument()) { 3586 if (is_main_frame_ && !navigation_state->WasWithinSameDocument()) {
3586 previews_state_ = 3587 previews_state_ = PREVIEWS_OFF;
3587 extra_data ? extra_data->previews_state() : PREVIEWS_OFF;
3588
3589 if (extra_data) { 3588 if (extra_data) {
3589 previews_state_ = UpdatePreviewsStateFromMainFrameResponse(
3590 extra_data->previews_state(), web_url_response);
3590 effective_connection_type_ = 3591 effective_connection_type_ =
3591 EffectiveConnectionTypeToWebEffectiveConnectionType( 3592 EffectiveConnectionTypeToWebEffectiveConnectionType(
3592 extra_data->effective_connection_type()); 3593 extra_data->effective_connection_type());
3593 } 3594 }
3594 } 3595 }
3595 3596
3596 if (proxy_routing_id_ != MSG_ROUTING_NONE) { 3597 if (proxy_routing_id_ != MSG_ROUTING_NONE) {
3597 // If this is a provisional frame associated with a proxy (i.e., a frame 3598 // If this is a provisional frame associated with a proxy (i.e., a frame
3598 // created for a remote-to-local navigation), swap it into the frame tree 3599 // created for a remote-to-local navigation), swap it into the frame tree
3599 // now. 3600 // now.
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
4005 return effective_connection_type_; 4006 return effective_connection_type_;
4006 } 4007 }
4007 4008
4008 bool RenderFrameImpl::ShouldUseClientLoFiForRequest( 4009 bool RenderFrameImpl::ShouldUseClientLoFiForRequest(
4009 const WebURLRequest& request) { 4010 const WebURLRequest& request) {
4010 if (request.GetPreviewsState() != WebURLRequest::kPreviewsUnspecified) 4011 if (request.GetPreviewsState() != WebURLRequest::kPreviewsUnspecified)
4011 return request.GetPreviewsState() & WebURLRequest::kClientLoFiOn; 4012 return request.GetPreviewsState() & WebURLRequest::kClientLoFiOn;
4012 4013
4013 if (!(previews_state_ & CLIENT_LOFI_ON)) 4014 if (!(previews_state_ & CLIENT_LOFI_ON))
4014 return false; 4015 return false;
4015 if (previews_state_ & 4016 if (previews_state_ & (PREVIEWS_OFF | PREVIEWS_NO_TRANSFORM)) {
4016 (SERVER_LITE_PAGE_ON | PREVIEWS_OFF | PREVIEWS_NO_TRANSFORM)) {
4017 return false; 4017 return false;
4018 } 4018 }
4019 4019
4020 // Even if this frame is using Server Lo-Fi, https:// images won't be handled 4020 // Even if this frame is using Server Lo-Fi, https:// images won't be handled
4021 // by Server Lo-Fi since their requests won't be sent to the Data Saver proxy, 4021 // by Server Lo-Fi since their requests won't be sent to the Data Saver proxy,
4022 // so use Client Lo-Fi instead. 4022 // so use Client Lo-Fi instead.
4023 if (previews_state_ & SERVER_LOFI_ON) 4023 if (previews_state_ & SERVER_LOFI_ON)
4024 return request.Url().ProtocolIs("https"); 4024 return request.Url().ProtocolIs("https");
4025 return true; 4025 return true;
4026 } 4026 }
(...skipping 2787 matching lines...) Expand 10 before | Expand all | Expand 10 after
6814 policy(info.default_policy), 6814 policy(info.default_policy),
6815 replaces_current_history_item(info.replaces_current_history_item), 6815 replaces_current_history_item(info.replaces_current_history_item),
6816 history_navigation_in_new_child_frame( 6816 history_navigation_in_new_child_frame(
6817 info.is_history_navigation_in_new_child_frame), 6817 info.is_history_navigation_in_new_child_frame),
6818 client_redirect(info.is_client_redirect), 6818 client_redirect(info.is_client_redirect),
6819 cache_disabled(info.is_cache_disabled), 6819 cache_disabled(info.is_cache_disabled),
6820 form(info.form), 6820 form(info.form),
6821 source_location(info.source_location) {} 6821 source_location(info.source_location) {}
6822 6822
6823 } // namespace content 6823 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698