0
Commit Graph

13 Commits

Author SHA1 Message Date
K. Moon
8d9054c8b9 Make PDF partial loading disabled the default
The experiment to disable PDF partial loading was successful, so we're
making it the default now.

The PdfPartialLoading and PdfIncrementalLoading features will be kept
for now for tests that rely on these features (often to test mostly
unrelated behaviors).

Fixed: 1115149
Change-Id: Iea45106f919d1fa608fcf6cfc28e432c88d4d75b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505972
Commit-Queue: Jesse Doherty <jwd@chromium.org>
Reviewed-by: Jesse Doherty <jwd@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823998}
2020-11-04 15:59:56 +00:00
K. Moon
07cd7b0b98 Stop using GetDownloadProgress() in the PDF viewer
Drops various GetDownloadProgress() APIs from the PDF viewer because:

1. We never call pp::URLRequestInfo::SetRecordDownloadProgress(), so
   calls to pp::URLLoader::GetDownloadProgress() always return false.
2. We only use GetDownloadProgress() in DocumentLoaderImpl, to try to
   get the total content length if we fail to get it from the
   Content-Length header. But the total content length reported by
   GetDownloadProgress() also comes from Content-Length, so this is not
   useful.
3. GetDownloadProgress() won't be useful post-Pepper, as
   blink::WebAssociatedURLLoader does not have a similar API. Instead,
   the client is expected to track this internally.

Bug: 1099022
Change-Id: I6f2f183e84b2d9e4c0dee2c116ac08bce3dc4ed0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429545
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810442}
2020-09-25 03:03:41 +00:00
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
Hui Yingst
eb451e419f Replace DISALLOW_COPY_AND_ASSIGN macros in pdf/.
This CL removes DISALLOW_COPY_AND_ASSIGN macros in pdf/ and uses
explicit deletions instead, since DISALLOW_COPY_AND_ASSIGN is
deprecated.

Bug: 1010217
Change-Id: Id6ed7fbc30bde1ad8b039f8b78799869699b7c93
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2347321
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796919}
2020-08-11 18:41:24 +00:00
K. Moon
f4c9f0612e Convert pdf/ to use MOCK_METHOD()
Now that crbug.com/989095 has been fixed, converts all uses of the
legacy MOCK_METHOD*() macros to use the modern MOCK_METHOD() instead.

Change-Id: Id22b3b4e8a0176ac17d9ef263ebe9eb87f558a6b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1934608
Auto-Submit: K. Moon <kmoon@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790269}
2020-07-21 07:05:31 +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
Lei Zhang
ad08617ff1 Clang-format the pdf/ directory.
Let it fix whatever nits it finds.

Change-Id: I910cebded2ad8b6b2eae786ad191a64d1980b901
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274467
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#783836}
2020-06-30 05:53:46 +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
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