Chromium Code Reviews| 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading |
| 6 | 6 |
| 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1232 // requets that have the ignore limits flag set. | 1232 // requets that have the ignore limits flag set. |
| 1233 if (is_sync_load) { | 1233 if (is_sync_load) { |
| 1234 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); | 1234 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); |
| 1235 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); | 1235 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); |
| 1236 } else { | 1236 } else { |
| 1237 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); | 1237 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); |
| 1238 } | 1238 } |
| 1239 new_request->SetLoadFlags(load_flags); | 1239 new_request->SetLoadFlags(load_flags); |
| 1240 | 1240 |
| 1241 // Make extra info and read footer (contains request ID). | 1241 // Make extra info and read footer (contains request ID). |
| 1242 ResourceRequestInfoImpl* extra_info = | 1242 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( |
|
nasko
2015/04/27 14:24:11
This reformat seems less readable : (
clamy
2015/04/27 16:19:12
Done. (git cl format is not always optimal..)
| |
| 1243 new ResourceRequestInfoImpl( | 1243 process_type, child_id, route_id, |
| 1244 process_type, | 1244 -1, // frame_tree_node_id |
| 1245 child_id, | 1245 request_data.origin_pid, request_id, request_data.render_frame_id, |
| 1246 route_id, | 1246 request_data.is_main_frame, request_data.parent_is_main_frame, |
| 1247 request_data.origin_pid, | 1247 request_data.parent_render_frame_id, request_data.resource_type, |
| 1248 request_id, | 1248 request_data.transition_type, request_data.should_replace_current_entry, |
| 1249 request_data.render_frame_id, | 1249 false, // is download |
| 1250 request_data.is_main_frame, | 1250 false, // is stream |
| 1251 request_data.parent_is_main_frame, | 1251 allow_download, request_data.has_user_gesture, |
| 1252 request_data.parent_render_frame_id, | 1252 request_data.enable_load_timing, request_data.enable_upload_progress, |
| 1253 request_data.resource_type, | 1253 do_not_prompt_for_login, request_data.referrer_policy, |
| 1254 request_data.transition_type, | 1254 request_data.visiblity_state, resource_context, filter_->GetWeakPtr(), |
| 1255 request_data.should_replace_current_entry, | 1255 !is_sync_load); |
| 1256 false, // is download | |
| 1257 false, // is stream | |
| 1258 allow_download, | |
| 1259 request_data.has_user_gesture, | |
| 1260 request_data.enable_load_timing, | |
| 1261 request_data.enable_upload_progress, | |
| 1262 do_not_prompt_for_login, | |
| 1263 request_data.referrer_policy, | |
| 1264 request_data.visiblity_state, | |
| 1265 resource_context, | |
| 1266 filter_->GetWeakPtr(), | |
| 1267 !is_sync_load); | |
| 1268 // Request takes ownership. | 1256 // Request takes ownership. |
| 1269 extra_info->AssociateWithRequest(new_request.get()); | 1257 extra_info->AssociateWithRequest(new_request.get()); |
| 1270 | 1258 |
| 1271 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 1259 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
| 1272 // Hang on to a reference to ensure the blob is not released prior | 1260 // Hang on to a reference to ensure the blob is not released prior |
| 1273 // to the job being started. | 1261 // to the job being started. |
| 1274 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 1262 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
| 1275 new_request.get(), | 1263 new_request.get(), |
| 1276 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL( | 1264 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL( |
| 1277 new_request->url())); | 1265 new_request->url())); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1494 | 1482 |
| 1495 loader->CancelRequest(true); | 1483 loader->CancelRequest(true); |
| 1496 } | 1484 } |
| 1497 | 1485 |
| 1498 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo( | 1486 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo( |
| 1499 int child_id, | 1487 int child_id, |
| 1500 int route_id, | 1488 int route_id, |
| 1501 bool download, | 1489 bool download, |
| 1502 ResourceContext* context) { | 1490 ResourceContext* context) { |
| 1503 return new ResourceRequestInfoImpl( | 1491 return new ResourceRequestInfoImpl( |
| 1504 PROCESS_TYPE_RENDERER, | 1492 PROCESS_TYPE_RENDERER, child_id, route_id, |
| 1505 child_id, | 1493 -1, // frame_tree_node_id |
| 1506 route_id, | 1494 0, request_id_, |
| 1507 0, | |
| 1508 request_id_, | |
| 1509 MSG_ROUTING_NONE, // render_frame_id | 1495 MSG_ROUTING_NONE, // render_frame_id |
| 1510 false, // is_main_frame | 1496 false, // is_main_frame |
| 1511 false, // parent_is_main_frame | 1497 false, // parent_is_main_frame |
| 1512 -1, // parent_render_frame_id | 1498 -1, // parent_render_frame_id |
| 1513 RESOURCE_TYPE_SUB_RESOURCE, | 1499 RESOURCE_TYPE_SUB_RESOURCE, ui::PAGE_TRANSITION_LINK, |
| 1514 ui::PAGE_TRANSITION_LINK, | |
| 1515 false, // should_replace_current_entry | 1500 false, // should_replace_current_entry |
| 1516 download, // is_download | 1501 download, // is_download |
| 1517 false, // is_stream | 1502 false, // is_stream |
| 1518 download, // allow_download | 1503 download, // allow_download |
| 1519 false, // has_user_gesture | 1504 false, // has_user_gesture |
| 1520 false, // enable_load_timing | 1505 false, // enable_load_timing |
| 1521 false, // enable_upload_progress | 1506 false, // enable_upload_progress |
| 1522 false, // do_not_prompt_for_login | 1507 false, // do_not_prompt_for_login |
| 1523 blink::WebReferrerPolicyDefault, | 1508 blink::WebReferrerPolicyDefault, blink::WebPageVisibilityStateVisible, |
| 1524 blink::WebPageVisibilityStateVisible, | |
| 1525 context, | 1509 context, |
| 1526 base::WeakPtr<ResourceMessageFilter>(), // filter | 1510 base::WeakPtr<ResourceMessageFilter>(), // filter |
| 1527 true); // is_async | 1511 true); // is_async |
| 1528 } | 1512 } |
| 1529 | 1513 |
| 1530 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, | 1514 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, |
| 1531 int route_id, | 1515 int route_id, |
| 1532 bool is_visible, | 1516 bool is_visible, |
| 1533 bool is_audible) { | 1517 bool is_audible) { |
| 1534 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); | 1518 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); |
| 1535 } | 1519 } |
| 1536 | 1520 |
| 1537 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( | 1521 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1940 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) | 1924 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) |
| 1941 .get())); | 1925 .get())); |
| 1942 } | 1926 } |
| 1943 | 1927 |
| 1944 request_id_--; | 1928 request_id_--; |
| 1945 | 1929 |
| 1946 // Make extra info and read footer (contains request ID). | 1930 // Make extra info and read footer (contains request ID). |
| 1947 // | 1931 // |
| 1948 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so | 1932 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so |
| 1949 // that IO thread -> UI thread hops will work. | 1933 // that IO thread -> UI thread hops will work. |
| 1950 ResourceRequestInfoImpl* extra_info = | 1934 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( |
| 1951 new ResourceRequestInfoImpl( | 1935 PROCESS_TYPE_BROWSER, |
| 1952 PROCESS_TYPE_BROWSER, | 1936 -1, // child_id |
| 1953 -1, // child_id | 1937 -1, // route_id |
| 1954 -1, // route_id | 1938 info.frame_tree_node_id, |
| 1955 -1, // request_data.origin_pid, | 1939 -1, // request_data.origin_pid, |
| 1956 request_id_, | 1940 request_id_, |
| 1957 -1, // request_data.render_frame_id, | 1941 -1, // request_data.render_frame_id, |
| 1958 info.is_main_frame, | 1942 info.is_main_frame, info.parent_is_main_frame, |
|
nasko
2015/04/27 14:24:11
This is even more confusing, some params are on th
clamy
2015/04/27 16:19:12
Done (git cl format again).
| |
| 1959 info.parent_is_main_frame, | 1943 -1, // request_data.parent_render_frame_id, |
| 1960 -1, // request_data.parent_render_frame_id, | 1944 resource_type, info.common_params.transition, |
| 1961 resource_type, | 1945 // should_replace_current_entry. This was only maintained at layer for |
| 1962 info.common_params.transition, | 1946 // request transfers and isn't needed for browser-side navigations. |
| 1963 // should_replace_current_entry. This was only maintained at layer for | 1947 false, |
| 1964 // request transfers and isn't needed for browser-side navigations. | 1948 false, // is download |
| 1965 false, | 1949 false, // is stream |
| 1966 false, // is download | 1950 info.common_params.allow_download, info.begin_params.has_user_gesture, |
| 1967 false, // is stream | 1951 true, // enable_load_timing |
| 1968 info.common_params.allow_download, | 1952 false, // enable_upload_progress |
| 1969 info.begin_params.has_user_gesture, | 1953 false, // do_not_prompt_for_login |
| 1970 true, // enable_load_timing | 1954 info.common_params.referrer.policy, |
| 1971 false, // enable_upload_progress | 1955 // TODO(davidben): This is only used for prerenders. Replace |
| 1972 false, // do_not_prompt_for_login | 1956 // is_showing with something for that. Or maybe it just comes from the |
| 1973 info.common_params.referrer.policy, | 1957 // same mechanism as the cookie one. |
| 1974 // TODO(davidben): This is only used for prerenders. Replace | 1958 blink::WebPageVisibilityStateVisible, resource_context, |
| 1975 // is_showing with something for that. Or maybe it just comes from the | 1959 base::WeakPtr<ResourceMessageFilter>(), // filter |
| 1976 // same mechanism as the cookie one. | 1960 true); |
| 1977 blink::WebPageVisibilityStateVisible, | |
| 1978 resource_context, | |
| 1979 base::WeakPtr<ResourceMessageFilter>(), // filter | |
| 1980 true); | |
| 1981 // Request takes ownership. | 1961 // Request takes ownership. |
| 1982 extra_info->AssociateWithRequest(new_request.get()); | 1962 extra_info->AssociateWithRequest(new_request.get()); |
| 1983 | 1963 |
| 1984 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 1964 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
| 1985 // Hang on to a reference to ensure the blob is not released prior | 1965 // Hang on to a reference to ensure the blob is not released prior |
| 1986 // to the job being started. | 1966 // to the job being started. |
| 1987 ChromeBlobStorageContext* blob_context = | 1967 ChromeBlobStorageContext* blob_context = |
| 1988 GetChromeBlobStorageContextForResourceContext(resource_context); | 1968 GetChromeBlobStorageContextForResourceContext(resource_context); |
| 1989 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 1969 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
| 1990 new_request.get(), | 1970 new_request.get(), |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2344 | 2324 |
| 2345 // Add a flag to selectively bypass the data reduction proxy if the resource | 2325 // Add a flag to selectively bypass the data reduction proxy if the resource |
| 2346 // type is not an image. | 2326 // type is not an image. |
| 2347 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2327 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
| 2348 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2328 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
| 2349 | 2329 |
| 2350 return load_flags; | 2330 return load_flags; |
| 2351 } | 2331 } |
| 2352 | 2332 |
| 2353 } // namespace content | 2333 } // namespace content |
| OLD | NEW |