0
Commit Graph

9 Commits

Author SHA1 Message Date
K. Moon
221749531b Make UrlLoader::GetDownloadProgress() null-safe
Changes chrome_pdf::UrlLoader::GetDownloadProgress() to take mutable
reference parameters, rather than pointers to int64_t.

Bug: 1099022
Change-Id: Ia6ab2fe8a2bdfa1909b06534647a226982c246ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2381251
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802559}
2020-08-28 07:07:32 +00:00
K. Moon
f2a1414a1c Control PDF partial loading with a feature
Adds a "PdfPartialLoading" feature to control whether or not the PDF
viewer tries to use partial loading. The default state is enabled, as
this feature has shipped already, but we would like to experiment with
disabling it to address certain problems related to partial loading.

Bug: 1115149
Change-Id: Ie66fddf5b633269226bc01fca20ac7013f0c1e7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2349429
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797378}
2020-08-12 19:39:40 +00:00
K. Moon
544e095375 Migrate URLLoaderWrapper to base::OnceCallback
Switches chrome_pdf::URLLoaderWrapper's API from pp::CompletionCallback
to base::OnceCallback. pp::CompletionCallback is still used internally
when calling Pepper APIs., but clients of URLLoaderWrapper no longer
need to deal with pp::CompletionCallback.

Using base::OnceCallback also simplifies resource management,
eliminating the need to manage references to pp::CompletionCallback.

With respect to thread safety, most Pepper APIs invoke asynchronous
callbacks on the original caller's thread, so there should be no new
thread safety issues. The base:: APIs also do sequence checking in
DCHECK mode, which should catch any unanticipated issues.

Bug: 1099022, 1101169
Change-Id: Ia355588b25b54a776ac972a7b5b2104b1a3b18c8
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2278169
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785816}
2020-07-07 17:08:55 +00:00
Hans Wennborg
5078d10ac4 Remove/replace unnecessary logging.h includes in .cc files (pdf)
CHECK, CHECK_EQ etc., and NOTREACHED/NOTIMPLEMENTED have moved
to the much smaller headers check.h, check_op.h, and notreached.h,
respectively.

This CL updates .cc files to use those headers instead when
possible, with the purpose of saving compile time.

(Split out from https://crrev.com/c/2164525 which also has
notes on how the change was generated.)

Bug: 1031540
Change-Id: Ia89f8dd8a7ca818e539d4be41556e247e9849017
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2164637
Auto-Submit: Hans Wennborg <hans@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#763916}
2020-04-29 18:26:46 +00:00
K. Moon
6f6c6e44bf Support partial loading in TestDocumentLoader
TestDocumentLoader currently loads the entire test PDF file as soon as
PDFiumEngine calls DocumentLoader::RequestData(0, 1). This change adds a
new TestDocumentLoader::SimulateLoadData(uint32_t) method that allows a
test to control how quickly the document loads.

A future test will take advantage of this to put the PDFiumEngine into a
partially-loaded state.

A test can request the TestDocumentLoader by calling PDFiumTestBase's
InitializeEngineWithoutLoading() method instead of InitializeEngine().

This change also removes the DocumentLoader::SetDocumentSize() method,
which only was used internally by DocumentLoaderImpl anyway.

Bug: 1051548
Change-Id: Ib5256aa70c468284e0f01964b409f2a85a9a066a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2067692
Commit-Queue: K Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751597}
2020-03-19 04:21:53 +00:00
Robbie McElrath
44e2d300a1 Remove MimeHandlerService::AbortStream
This CL removes MimeHandlerService::AbortStream and all uses of it,
since it's a no-op. The pdf viewer currently calls it via
CancelBrowserDownload, which this CL also removes. The pdf request
actually gets stopped by resetting the chrome_pdf::URLLoaderWrapper,
which closes the connection on desctruction.

Bug: 934009
Change-Id: Ib3cc6fb1aa12270d39c16a6770d3726a3198682c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1696444
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Cr-Commit-Position: refs/heads/master@{#677545}
2019-07-15 23:28:55 +00:00
Henrique Nakashima
1c5da8e63c Use constexpr where possible in src/pdf.
Change-Id: Icd771944352b9c161933c477fe714492aa38bbe7
Reviewed-on: https://chromium-review.googlesource.com/c/1265637
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597327}
2018-10-05 21:56:43 +00:00
Artem Strygin
2cf20af4f3 Fix download PDF document with server extra data.
In case of range request, if server send unexpectedly
extra data, ignore it.

BUG=825829

Steps to reproduce:
1) Clear browser cache.
2) Open PDF:
http://www.major-landrover.ru/upload/attachments/f/9/f96aab07dab04ae89c8a509ec1ef2b31.pdf#page=55
3) Wait until document finish loading

Expected:
 The loading of document is finished
Actual:
 Some times the loading of document is never finished.

Change-Id: I46fc8001bea5701e1e93d26d1ea6527d4736ff05
Reviewed-on: https://chromium-review.googlesource.com/1094634
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Cr-Commit-Position: refs/heads/master@{#567257}
2018-06-14 14:26:53 +00:00
Lei Zhang
e98901a4b4 PDF: Make DocumentLoader an interface.
To make it easier to write fake DocumentLoaders for testing. Split the
implementation off into DocumentLoaderImpl.

Change-Id: I44f16c757b8a9be133936c41c231a552a7e05f0a
Reviewed-on: https://chromium-review.googlesource.com/1013998
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553816}
2018-04-25 23:23:59 +00:00