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

Side by Side Diff: fpdfsdk/fpdfview.cpp

Issue 2340523002: [Merge to 54] Fixup CPDFSDK_PageView and CPDF_Page interactions. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | fpdfsdk/fsdk_mgr.cpp » ('j') | fpdfsdk/include/fsdk_mgr.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "public/fpdfview.h" 7 #include "public/fpdfview.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 666
667 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page) { 667 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page) {
668 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); 668 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
669 if (!page) 669 if (!page)
670 return; 670 return;
671 #ifdef PDF_ENABLE_XFA 671 #ifdef PDF_ENABLE_XFA
672 pPage->Release(); 672 pPage->Release();
673 #else // PDF_ENABLE_XFA 673 #else // PDF_ENABLE_XFA
674 CPDFSDK_PageView* pPageView = 674 CPDFSDK_PageView* pPageView =
675 static_cast<CPDFSDK_PageView*>(pPage->GetView()); 675 static_cast<CPDFSDK_PageView*>(pPage->GetView());
676 if (pPageView && pPageView->IsLocked()) { 676 if (pPageView) {
677 pPageView->TakeOverPage(); 677 if (pPageView->IsLocked()) {
678 return; 678 pPageView->TakePageOwnership();
679 return;
680 }
681
682 bool owned = pPageView->OwnsPage();
683 // This will delete the |pPageView| object. We must cleanup the PageView
684 // first because it will attempt to reset the View on the |pPage| during
685 // destruction.
686 pPageView->GetSDKDocument()->RemovePageView(pPage);
687 // If the page was owned then the pageview will have deleted the page.
688 if (owned)
689 return;
679 } 690 }
680 delete pPage; 691 delete pPage;
681 #endif // PDF_ENABLE_XFA 692 #endif // PDF_ENABLE_XFA
682 } 693 }
683 694
684 DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document) { 695 DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document) {
685 delete UnderlyingFromFPDFDocument(document); 696 delete UnderlyingFromFPDFDocument(document);
686 } 697 }
687 698
688 DLLEXPORT unsigned long STDCALL FPDF_GetLastError() { 699 DLLEXPORT unsigned long STDCALL FPDF_GetLastError() {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 if (!buffer) { 1128 if (!buffer) {
1118 *buflen = len; 1129 *buflen = len;
1119 } else if (*buflen >= len) { 1130 } else if (*buflen >= len) {
1120 memcpy(buffer, utf16Name.c_str(), len); 1131 memcpy(buffer, utf16Name.c_str(), len);
1121 *buflen = len; 1132 *buflen = len;
1122 } else { 1133 } else {
1123 *buflen = -1; 1134 *buflen = -1;
1124 } 1135 }
1125 return (FPDF_DEST)pDestObj; 1136 return (FPDF_DEST)pDestObj;
1126 } 1137 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/fsdk_mgr.cpp » ('j') | fpdfsdk/include/fsdk_mgr.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698