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

Side by Side Diff: pdf/pdf.cc

Issue 2828413005: Clang format pdf/ (Closed)
Patch Set: Manual tweaks Created 3 years, 8 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 | « pdf/paint_manager.cc ('k') | pdf/pdfium/pdfium_api_string_buffer_adapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium 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 #include "pdf/pdf.h" 5 #include "pdf/pdf.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
11 #endif 11 #endif
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "pdf/out_of_process_instance.h" 15 #include "pdf/out_of_process_instance.h"
16 #include "ppapi/c/ppp.h" 16 #include "ppapi/c/ppp.h"
17 #include "ppapi/cpp/private/internal_module.h" 17 #include "ppapi/cpp/private/internal_module.h"
18 #include "ppapi/cpp/private/pdf.h" 18 #include "ppapi/cpp/private/pdf.h"
19 #include "v8/include/v8.h" 19 #include "v8/include/v8.h"
20 20
21 namespace chrome_pdf { 21 namespace chrome_pdf {
22 22
23 namespace { 23 namespace {
24 24
25 bool g_sdk_initialized_via_pepper = false; 25 bool g_sdk_initialized_via_pepper = false;
26 26
27 } // namespace 27 } // namespace
28 28
29 PDFModule::PDFModule() { 29 PDFModule::PDFModule() {}
30 }
31 30
32 PDFModule::~PDFModule() { 31 PDFModule::~PDFModule() {
33 if (g_sdk_initialized_via_pepper) { 32 if (g_sdk_initialized_via_pepper) {
34 ShutdownSDK(); 33 ShutdownSDK();
35 g_sdk_initialized_via_pepper = false; 34 g_sdk_initialized_via_pepper = false;
36 } 35 }
37 } 36 }
38 37
39 bool PDFModule::Init() { 38 bool PDFModule::Init() {
40 return true; 39 return true;
(...skipping 11 matching lines...) Expand all
52 v8::V8::SetSnapshotDataBlob(&snapshot); 51 v8::V8::SetSnapshotDataBlob(&snapshot);
53 } 52 }
54 if (!InitializeSDK()) 53 if (!InitializeSDK())
55 return nullptr; 54 return nullptr;
56 g_sdk_initialized_via_pepper = true; 55 g_sdk_initialized_via_pepper = true;
57 } 56 }
58 57
59 return new OutOfProcessInstance(instance); 58 return new OutOfProcessInstance(instance);
60 } 59 }
61 60
62
63 // Implementation of Global PPP functions --------------------------------- 61 // Implementation of Global PPP functions ---------------------------------
64 int32_t PPP_InitializeModule(PP_Module module_id, 62 int32_t PPP_InitializeModule(PP_Module module_id,
65 PPB_GetInterface get_browser_interface) { 63 PPB_GetInterface get_browser_interface) {
66 std::unique_ptr<PDFModule> module(new PDFModule); 64 std::unique_ptr<PDFModule> module(new PDFModule);
67 if (!module->InternalInit(module_id, get_browser_interface)) 65 if (!module->InternalInit(module_id, get_browser_interface))
68 return PP_ERROR_FAILED; 66 return PP_ERROR_FAILED;
69 67
70 pp::InternalSetModuleSingleton(module.release()); 68 pp::InternalSetModuleSingleton(module.release());
71 return PP_OK; 69 return PP_OK;
72 } 70 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 autorotate); 180 autorotate);
183 bool ret = engine_exports->RenderPDFPageToBitmap( 181 bool ret = engine_exports->RenderPDFPageToBitmap(
184 pdf_buffer, pdf_buffer_size, page_number, settings, bitmap_buffer); 182 pdf_buffer, pdf_buffer_size, page_number, settings, bitmap_buffer);
185 if (!g_sdk_initialized_via_pepper) 183 if (!g_sdk_initialized_via_pepper)
186 ShutdownSDK(); 184 ShutdownSDK();
187 185
188 return ret; 186 return ret;
189 } 187 }
190 188
191 } // namespace chrome_pdf 189 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « pdf/paint_manager.cc ('k') | pdf/pdfium/pdfium_api_string_buffer_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698