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

Unified Diff: testing/embedder_test.cpp

Issue 1353093003: Support linearized loading (Closed) Base URL: https://pdfium.googlesource.com/pdfium.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 side-by-side diff with in-line comments
Download patch
Index: testing/embedder_test.cpp
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index eb16bc70f9cbd2f07d80b48abfc06423629875a2..87359feb30153bfabb5ef06449c61bd5fecfa180 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -15,7 +15,7 @@
#include <vector>
#include "../public/fpdf_text.h"
-#include "../public/fpdfview.h"
+#include "../public/fpdf_dataavail.h"
Tom Sepez 2015/09/22 19:17:59 nit: alphabetize.
jun_fang 2015/09/23 12:26:59 Acknowledged.
#include "testing/gmock/include/gmock/gmock.h"
#include "v8/include/libplatform/libplatform.h"
#include "v8/include/v8.h"
@@ -200,16 +200,28 @@ bool EmbedderTest::OpenDocument(const std::string& filename) {
hints_.AddSegment = Add_Segment;
avail_ = FPDFAvail_Create(&file_avail_, &file_access_);
- (void)FPDFAvail_IsDocAvail(avail_, &hints_);
-
- if (!FPDFAvail_IsLinearized(avail_)) {
+ if (FPDFAvail_IsLinearized(avail_) != FSDK_IS_LINEARIZED) {
document_ = FPDF_LoadCustomDocument(&file_access_, nullptr);
} else {
document_ = FPDFAvail_GetDocument(avail_, nullptr);
+ while (true) {
Tom Sepez 2015/09/22 19:17:59 strange spinnng here. do you have to yield or chec
jun_fang 2015/09/23 12:26:59 If the return value is false, that means we need t
Tom Sepez 2015/09/24 18:24:40 So...do we need an IFX_Pause or some such to check
+ if (FPDFAvail_IsDocAvail(avail_, &hints_))
+ break;
+ }
+ if (FPDFAvail_IsFormAvail(avail_, &hints_) == PDFFORM_NOTAVAIL) {
+ return false;
+ }
+ int page_count = FPDF_GetPageCount(document_);
+ for (int i = 0; i < page_count; ++i) {
+ while (true) {
Tom Sepez 2015/09/22 19:17:59 nit: same here.
jun_fang 2015/09/23 12:26:59 Acknowledged.
+ if (FPDFAvail_IsPageAvail(avail_, i, &hints_))
+ break;
+ }
+ }
}
-
+ if (!document_)
+ return false;
(void)FPDF_GetDocPermissions(document_);
- (void)FPDFAvail_IsFormAvail(avail_, &hints_);
IPDF_JSPLATFORM* platform = static_cast<IPDF_JSPLATFORM*>(this);
memset(platform, 0, sizeof(IPDF_JSPLATFORM));

Powered by Google App Engine
This is Rietveld 408576698