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

Side by Side Diff: pdf/out_of_process_instance.cc

Issue 1323943011: Fix memory leak of PreviewModeClient in PDF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« pdf/out_of_process_instance.h ('K') | « pdf/out_of_process_instance.h ('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 (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 <algorithm> // for min/max() 7 #include <algorithm> // for min/max()
8 #define _USE_MATH_DEFINES // for M_PI 8 #define _USE_MATH_DEFINES // for M_PI
9 #include <cmath> // for log() and pow() 9 #include <cmath> // for log() and pow()
10 #include <math.h> 10 #include <math.h>
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 // TODO(raymes): Make this clearer once the in-process plugin is deleted. 775 // TODO(raymes): Make this clearer once the in-process plugin is deleted.
776 if (engine_->IsProgressiveLoad()) { 776 if (engine_->IsProgressiveLoad()) {
777 pp::VarDictionary message; 777 pp::VarDictionary message;
778 message.Set(kType, kJSCancelStreamUrlType); 778 message.Set(kType, kJSCancelStreamUrlType);
779 PostMessage(message); 779 PostMessage(message);
780 } 780 }
781 } 781 }
782 782
783 void OutOfProcessInstance::DidOpenPreview(int32_t result) { 783 void OutOfProcessInstance::DidOpenPreview(int32_t result) {
784 if (result == PP_OK) { 784 if (result == PP_OK) {
785 preview_engine_.reset(PDFEngine::Create(new PreviewModeClient(this))); 785 preview_client_.reset(new PreviewModeClient(this));
786 preview_engine_.reset(PDFEngine::Create(preview_client_.get()));
786 preview_engine_->HandleDocumentLoad(embed_preview_loader_); 787 preview_engine_->HandleDocumentLoad(embed_preview_loader_);
787 } else { 788 } else {
788 NOTREACHED(); 789 NOTREACHED();
789 } 790 }
790 } 791 }
791 792
792 void OutOfProcessInstance::OnClientTimerFired(int32_t id) { 793 void OutOfProcessInstance::OnClientTimerFired(int32_t id) {
793 engine_->OnCallback(id); 794 engine_->OnCallback(id);
794 } 795 }
795 796
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 const pp::FloatPoint& scroll_offset) { 1437 const pp::FloatPoint& scroll_offset) {
1437 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); 1438 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width();
1438 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); 1439 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f);
1439 float min_y = -top_toolbar_height_; 1440 float min_y = -top_toolbar_height_;
1440 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); 1441 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height();
1441 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); 1442 float y = std::max(std::min(scroll_offset.y(), max_y), min_y);
1442 return pp::FloatPoint(x, y); 1443 return pp::FloatPoint(x, y);
1443 } 1444 }
1444 1445
1445 } // namespace chrome_pdf 1446 } // namespace chrome_pdf
OLDNEW
« pdf/out_of_process_instance.h ('K') | « pdf/out_of_process_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698