| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_UTILITY_PDF_COMPOSITOR_IMPL_H_ |
| 6 #define CHROME_UTILITY_PDF_COMPOSITOR_IMPL_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <map> |
| 11 #include <memory> |
| 12 #include <set> |
| 13 |
| 14 #include "base/macros.h" |
| 15 #include "base/memory/shared_memory.h" |
| 16 #include "services/pdf_compositor/public/interfaces/pdf_compositor.mojom.h" |
| 17 #include "services/service_manager/public/cpp/service_context_ref.h" |
| 18 |
| 19 namespace pdf_compositor { |
| 20 |
| 21 class PdfCompositorImpl : public mojom::PdfCompositor { |
| 22 public: |
| 23 explicit PdfCompositorImpl( |
| 24 std::unique_ptr<service_manager::ServiceContextRef> service_ref); |
| 25 ~PdfCompositorImpl() override; |
| 26 |
| 27 void PrepareSubframe(int subframeId, int page_num) override; |
| 28 |
| 29 // Add a subframe drawable for composition. |
| 30 void AddSubFrameContent(int subframeId, |
| 31 mojo::ScopedSharedBufferHandle sk_handle) override; |
| 32 |
| 33 // Query whether all subframes are ready. |
| 34 void IsReadyToComposite( |
| 35 int page_num, |
| 36 const mojom::PdfCompositor::IsReadyToCompositeCallback& callback) |
| 37 override; |
| 38 |
| 39 // Composite a pdf file from content of one or more subframe. |
| 40 void CompositePdf( |
| 41 mojo::ScopedSharedBufferHandle sk_handle, |
| 42 const mojom::PdfCompositor::CompositePdfCallback& callback) override; |
| 43 |
| 44 private: |
| 45 const std::unique_ptr<service_manager::ServiceContextRef> service_ref_; |
| 46 |
| 47 // Map a page with all the non-painted remote subframes in it. |
| 48 std::map<int, std::set<int>> pending_subframes_in_page_; |
| 49 |
| 50 // Map a remote subframe with all the pages which contain it. |
| 51 std::map<int, std::set<int>> pages_with_subframe_; |
| 52 |
| 53 std::set<int> painted_subframes_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(PdfCompositorImpl); |
| 56 }; |
| 57 |
| 58 } // namespace pdf_compositor |
| 59 |
| 60 #endif // CHROME_UTILITY_PDF_COMPOSITOR_IMPL_H_ |
| OLD | NEW |