OLD | NEW |
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 5526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5537 if (save_status == MhtmlSaveStatus::SUCCESS) { | 5537 if (save_status == MhtmlSaveStatus::SUCCESS) { |
5538 TRACE_EVENT0("page-serialization", | 5538 TRACE_EVENT0("page-serialization", |
5539 "RenderFrameImpl::OnSerializeAsMHTML parts serialization"); | 5539 "RenderFrameImpl::OnSerializeAsMHTML parts serialization"); |
5540 // The returned data can be empty if the frame should be skipped, but this | 5540 // The returned data can be empty if the frame should be skipped, but this |
5541 // is OK. | 5541 // is OK. |
5542 mhtml_contents.emplace_back(WebFrameSerializer::generateMHTMLParts( | 5542 mhtml_contents.emplace_back(WebFrameSerializer::generateMHTMLParts( |
5543 mhtml_boundary, GetWebFrame(), &delegate)); | 5543 mhtml_boundary, GetWebFrame(), &delegate)); |
5544 has_some_data |= !mhtml_contents.back().isEmpty(); | 5544 has_some_data |= !mhtml_contents.back().isEmpty(); |
5545 } | 5545 } |
5546 | 5546 |
5547 // Generate MHTML footer if needed. | 5547 // Note: the MHTML footer is written by the browser process, after the last |
5548 if (save_status == MhtmlSaveStatus::SUCCESS && params.is_last_frame) { | 5548 // frame is serialized by a renderer process. |
5549 TRACE_EVENT0("page-serialization", | |
5550 "RenderFrameImpl::OnSerializeAsMHTML footer"); | |
5551 mhtml_contents.emplace_back( | |
5552 WebFrameSerializer::generateMHTMLFooter(mhtml_boundary)); | |
5553 has_some_data |= !mhtml_contents.back().isEmpty(); | |
5554 } | |
5555 | 5549 |
5556 // Note: we assume RenderFrameImpl::OnWriteMHTMLToDiskComplete and the rest of | 5550 // Note: we assume RenderFrameImpl::OnWriteMHTMLToDiskComplete and the rest of |
5557 // this function will be fast enough to not need to be accounted for in this | 5551 // this function will be fast enough to not need to be accounted for in this |
5558 // metric. | 5552 // metric. |
5559 base::TimeDelta main_thread_use_time = base::TimeTicks::Now() - start_time; | 5553 base::TimeDelta main_thread_use_time = base::TimeTicks::Now() - start_time; |
5560 UMA_HISTOGRAM_TIMES( | 5554 UMA_HISTOGRAM_TIMES( |
5561 "PageSerialization.MhtmlGeneration.RendererMainThreadTime.SingleFrame", | 5555 "PageSerialization.MhtmlGeneration.RendererMainThreadTime.SingleFrame", |
5562 main_thread_use_time); | 5556 main_thread_use_time); |
5563 | 5557 |
5564 if (save_status == MhtmlSaveStatus::SUCCESS && has_some_data) { | 5558 if (save_status == MhtmlSaveStatus::SUCCESS && has_some_data) { |
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6849 // event target. Potentially a Pepper plugin will receive the event. | 6843 // event target. Potentially a Pepper plugin will receive the event. |
6850 // In order to tell whether a plugin gets the last mouse event and which it | 6844 // In order to tell whether a plugin gets the last mouse event and which it |
6851 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6845 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6852 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6846 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6853 // |pepper_last_mouse_event_target_|. | 6847 // |pepper_last_mouse_event_target_|. |
6854 pepper_last_mouse_event_target_ = nullptr; | 6848 pepper_last_mouse_event_target_ = nullptr; |
6855 #endif | 6849 #endif |
6856 } | 6850 } |
6857 | 6851 |
6858 } // namespace content | 6852 } // namespace content |
OLD | NEW |