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

Side by Side Diff: pdf/out_of_process_instance.cc

Issue 2551153002: Revert of Improve linearized pdf load/show time. (Closed)
Patch Set: Rebase to master Created 4 years 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 | « pdf/out_of_process_instance.h ('k') | pdf/pdf_engine.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "pdf/out_of_process_instance.h" 5 #include "pdf/out_of_process_instance.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> // for min/max() 10 #include <algorithm> // for min/max()
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 } 938 }
939 } 939 }
940 } 940 }
941 941
942 engine_->PostPaint(); 942 engine_->PostPaint();
943 } 943 }
944 944
945 void OutOfProcessInstance::DidOpen(int32_t result) { 945 void OutOfProcessInstance::DidOpen(int32_t result) {
946 if (result != PP_OK || !engine_->HandleDocumentLoad(embed_loader_)) 946 if (result != PP_OK || !engine_->HandleDocumentLoad(embed_loader_))
947 DocumentLoadFailed(); 947 DocumentLoadFailed();
948
949 // If it's a progressive load, cancel the stream URL request so that requests
950 // can be made on the original URL.
951 // TODO(raymes): Make this clearer once the in-process plugin is deleted.
952 if (engine_->IsProgressiveLoad()) {
953 pp::VarDictionary message;
954 message.Set(kType, kJSCancelStreamUrlType);
955 PostMessage(message);
956 }
948 } 957 }
949 958
950 void OutOfProcessInstance::DidOpenPreview(int32_t result) { 959 void OutOfProcessInstance::DidOpenPreview(int32_t result) {
951 if (result == PP_OK) { 960 if (result == PP_OK) {
952 preview_client_ = base::MakeUnique<PreviewModeClient>(this); 961 preview_client_ = base::MakeUnique<PreviewModeClient>(this);
953 preview_engine_.reset(PDFEngine::Create(preview_client_.get())); 962 preview_engine_.reset(PDFEngine::Create(preview_client_.get()));
954 preview_engine_->HandleDocumentLoad(embed_preview_loader_); 963 preview_engine_->HandleDocumentLoad(embed_preview_loader_);
955 } else { 964 } else {
956 NOTREACHED(); 965 NOTREACHED();
957 } 966 }
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 } 1576 }
1568 1577
1569 bool OutOfProcessInstance::IsPrintPreview() { 1578 bool OutOfProcessInstance::IsPrintPreview() {
1570 return is_print_preview_; 1579 return is_print_preview_;
1571 } 1580 }
1572 1581
1573 uint32_t OutOfProcessInstance::GetBackgroundColor() { 1582 uint32_t OutOfProcessInstance::GetBackgroundColor() {
1574 return background_color_; 1583 return background_color_;
1575 } 1584 }
1576 1585
1577 void OutOfProcessInstance::CancelBrowserDownload() {
1578 pp::VarDictionary message;
1579 message.Set(kType, kJSCancelStreamUrlType);
1580 PostMessage(message);
1581 }
1582
1583 void OutOfProcessInstance::IsSelectingChanged(bool is_selecting) { 1586 void OutOfProcessInstance::IsSelectingChanged(bool is_selecting) {
1584 pp::VarDictionary message; 1587 pp::VarDictionary message;
1585 message.Set(kType, kJSSetIsSelectingType); 1588 message.Set(kType, kJSSetIsSelectingType);
1586 message.Set(kJSIsSelecting, pp::Var(is_selecting)); 1589 message.Set(kJSIsSelecting, pp::Var(is_selecting));
1587 PostMessage(message); 1590 PostMessage(message);
1588 } 1591 }
1589 1592
1590 void OutOfProcessInstance::ProcessPreviewPageInfo(const std::string& url, 1593 void OutOfProcessInstance::ProcessPreviewPageInfo(const std::string& url,
1591 int dst_page_index) { 1594 int dst_page_index) {
1592 DCHECK(IsPrintPreview()); 1595 DCHECK(IsPrintPreview());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 const pp::FloatPoint& scroll_offset) { 1631 const pp::FloatPoint& scroll_offset) {
1629 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); 1632 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width();
1630 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); 1633 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f);
1631 float min_y = -top_toolbar_height_; 1634 float min_y = -top_toolbar_height_;
1632 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); 1635 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height();
1633 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); 1636 float y = std::max(std::min(scroll_offset.y(), max_y), min_y);
1634 return pp::FloatPoint(x, y); 1637 return pp::FloatPoint(x, y);
1635 } 1638 }
1636 1639
1637 } // namespace chrome_pdf 1640 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « pdf/out_of_process_instance.h ('k') | pdf/pdf_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698