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

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

Issue 2002413002: Revert of Deduplicating code performing WebHTTPBody::Element conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « content/renderer/http_body_conversions.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 #include "content/renderer/browser_plugin/browser_plugin_manager.h" 88 #include "content/renderer/browser_plugin/browser_plugin_manager.h"
89 #include "content/renderer/child_frame_compositing_helper.h" 89 #include "content/renderer/child_frame_compositing_helper.h"
90 #include "content/renderer/context_menu_params_builder.h" 90 #include "content/renderer/context_menu_params_builder.h"
91 #include "content/renderer/devtools/devtools_agent.h" 91 #include "content/renderer/devtools/devtools_agent.h"
92 #include "content/renderer/dom_automation_controller.h" 92 #include "content/renderer/dom_automation_controller.h"
93 #include "content/renderer/effective_connection_type_helper.h" 93 #include "content/renderer/effective_connection_type_helper.h"
94 #include "content/renderer/external_popup_menu.h" 94 #include "content/renderer/external_popup_menu.h"
95 #include "content/renderer/gpu/gpu_benchmarking_extension.h" 95 #include "content/renderer/gpu/gpu_benchmarking_extension.h"
96 #include "content/renderer/history_controller.h" 96 #include "content/renderer/history_controller.h"
97 #include "content/renderer/history_serialization.h" 97 #include "content/renderer/history_serialization.h"
98 #include "content/renderer/http_body_conversions.h"
99 #include "content/renderer/image_downloader/image_downloader_impl.h" 98 #include "content/renderer/image_downloader/image_downloader_impl.h"
100 #include "content/renderer/ime_event_guard.h" 99 #include "content/renderer/ime_event_guard.h"
101 #include "content/renderer/internal_document_state_data.h" 100 #include "content/renderer/internal_document_state_data.h"
102 #include "content/renderer/manifest/manifest_manager.h" 101 #include "content/renderer/manifest/manifest_manager.h"
103 #include "content/renderer/media/audio_device_factory.h" 102 #include "content/renderer/media/audio_device_factory.h"
104 #include "content/renderer/media/media_permission_dispatcher.h" 103 #include "content/renderer/media/media_permission_dispatcher.h"
105 #include "content/renderer/media/media_stream_dispatcher.h" 104 #include "content/renderer/media/media_stream_dispatcher.h"
106 #include "content/renderer/media/media_stream_renderer_factory_impl.h" 105 #include "content/renderer/media/media_stream_renderer_factory_impl.h"
107 #include "content/renderer/media/midi_dispatcher.h" 106 #include "content/renderer/media/midi_dispatcher.h"
108 #include "content/renderer/media/render_media_log.h" 107 #include "content/renderer/media/render_media_log.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 common_params.report_type)); 540 common_params.report_type));
542 return request; 541 return request;
543 } 542 }
544 543
545 // Converts the HTTP body data stored in ResourceRequestBody format to a 544 // Converts the HTTP body data stored in ResourceRequestBody format to a
546 // WebHTTPBody, which is then added to the WebURLRequest. 545 // WebHTTPBody, which is then added to the WebURLRequest.
547 // PlzNavigate: used to add the POST data sent by the renderer at commit time 546 // PlzNavigate: used to add the POST data sent by the renderer at commit time
548 // to the WebURLRequest used to commit the navigation. This ensures that the 547 // to the WebURLRequest used to commit the navigation. This ensures that the
549 // POST data will be in the PageState sent to the browser on commit. 548 // POST data will be in the PageState sent to the browser on commit.
550 void AddHTTPBodyToRequest(WebURLRequest* request, 549 void AddHTTPBodyToRequest(WebURLRequest* request,
551 const scoped_refptr<ResourceRequestBody>& body) { 550 scoped_refptr<ResourceRequestBody> body) {
552 WebHTTPBody http_body; 551 WebHTTPBody http_body;
553 http_body.initialize(); 552 http_body.initialize();
554 http_body.setIdentifier(body->identifier()); 553 http_body.setIdentifier(body->identifier());
555 for (const ResourceRequestBody::Element& element : *(body->elements())) 554 for (const ResourceRequestBody::Element& element : *(body->elements())) {
556 AppendHttpBodyElement(element, &http_body); 555 long long length = -1;
556 switch (element.type()) {
557 case storage::DataElement::TYPE_BYTES:
558 http_body.appendData(WebData(element.bytes(), element.length()));
559 break;
560 case storage::DataElement::TYPE_FILE:
561 if (element.length() != std::numeric_limits<uint64_t>::max())
562 length = element.length();
563 http_body.appendFileRange(
564 element.path().AsUTF16Unsafe(), element.offset(), length,
565 element.expected_modification_time().ToDoubleT());
566 break;
567 case storage::DataElement::TYPE_FILE_FILESYSTEM:
568 http_body.appendFileSystemURLRange(
569 element.filesystem_url(), element.offset(), element.length(),
570 element.expected_modification_time().ToDoubleT());
571 break;
572 case storage::DataElement::TYPE_BLOB:
573 http_body.appendBlob(WebString::fromUTF8(element.blob_uuid()));
574 break;
575 default:
576 // TYPE_BYTES_DESCRIPTION and TYPE_DISK_CACHE_ENTRY should not be
577 // encountered.
578 NOTREACHED();
579 break;
580 }
581 }
557 request->setHTTPBody(http_body); 582 request->setHTTPBody(http_body);
558 } 583 }
559 584
560 // Sanitizes the navigation_start timestamp for browser-initiated navigations, 585 // Sanitizes the navigation_start timestamp for browser-initiated navigations,
561 // where the browser possibly has a better notion of start time than the 586 // where the browser possibly has a better notion of start time than the
562 // renderer. In the case of cross-process navigations, this carries over the 587 // renderer. In the case of cross-process navigations, this carries over the
563 // time of finishing the onbeforeunload handler of the previous page. 588 // time of finishing the onbeforeunload handler of the previous page.
564 // TimeTicks is sometimes not monotonic across processes, and because 589 // TimeTicks is sometimes not monotonic across processes, and because
565 // |browser_navigation_start| is likely before this process existed, 590 // |browser_navigation_start| is likely before this process existed,
566 // InterProcessTimeTicksConverter won't help. The timestamp is sanitized by 591 // InterProcessTimeTicksConverter won't help. The timestamp is sanitized by
(...skipping 5612 matching lines...) Expand 10 before | Expand all | Expand 10 after
6179 // event target. Potentially a Pepper plugin will receive the event. 6204 // event target. Potentially a Pepper plugin will receive the event.
6180 // In order to tell whether a plugin gets the last mouse event and which it 6205 // In order to tell whether a plugin gets the last mouse event and which it
6181 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6206 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6182 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6207 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6183 // |pepper_last_mouse_event_target_|. 6208 // |pepper_last_mouse_event_target_|.
6184 pepper_last_mouse_event_target_ = nullptr; 6209 pepper_last_mouse_event_target_ = nullptr;
6185 #endif 6210 #endif
6186 } 6211 }
6187 6212
6188 } // namespace content 6213 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/http_body_conversions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698