| OLD | NEW | 
|    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 #if defined(OS_WIN) |    7 #if defined(OS_WIN) | 
|    8 #include <windows.h> |    8 #include <windows.h> | 
|    9 #endif |    9 #endif | 
|   10  |   10  | 
|   11 #include "base/command_line.h" |   11 #include "base/command_line.h" | 
|   12 #include "base/logging.h" |   12 #include "base/logging.h" | 
|   13 #include "pdf/instance.h" |  | 
|   14 #include "pdf/out_of_process_instance.h" |   13 #include "pdf/out_of_process_instance.h" | 
|   15 #include "ppapi/c/ppp.h" |   14 #include "ppapi/c/ppp.h" | 
|   16 #include "ppapi/cpp/private/internal_module.h" |   15 #include "ppapi/cpp/private/internal_module.h" | 
|   17 #include "ppapi/cpp/private/pdf.h" |   16 #include "ppapi/cpp/private/pdf.h" | 
|   18 #include "v8/include/v8.h" |   17 #include "v8/include/v8.h" | 
|   19  |   18  | 
|   20 bool g_sdk_initialized_via_pepper = false; |   19 bool g_sdk_initialized_via_pepper = false; | 
|   21  |   20  | 
|   22 namespace chrome_pdf { |   21 namespace chrome_pdf { | 
|   23  |   22  | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
|   44                                        &snapshot.data, &snapshot.raw_size); |   43                                        &snapshot.data, &snapshot.raw_size); | 
|   45     if (natives.data) { |   44     if (natives.data) { | 
|   46       v8::V8::SetNativesDataBlob(&natives); |   45       v8::V8::SetNativesDataBlob(&natives); | 
|   47       v8::V8::SetSnapshotDataBlob(&snapshot); |   46       v8::V8::SetSnapshotDataBlob(&snapshot); | 
|   48     } |   47     } | 
|   49     if (!chrome_pdf::InitializeSDK()) |   48     if (!chrome_pdf::InitializeSDK()) | 
|   50       return NULL; |   49       return NULL; | 
|   51     g_sdk_initialized_via_pepper = true; |   50     g_sdk_initialized_via_pepper = true; | 
|   52   } |   51   } | 
|   53  |   52  | 
|   54   if (pp::PDF::IsOutOfProcess(pp::InstanceHandle(instance))) |   53   return new OutOfProcessInstance(instance); | 
|   55     return new OutOfProcessInstance(instance); |  | 
|   56   return new Instance(instance); |  | 
|   57 } |   54 } | 
|   58  |   55  | 
|   59  |   56  | 
|   60 // Implementation of Global PPP functions --------------------------------- |   57 // Implementation of Global PPP functions --------------------------------- | 
|   61 int32_t PPP_InitializeModule(PP_Module module_id, |   58 int32_t PPP_InitializeModule(PP_Module module_id, | 
|   62                              PPB_GetInterface get_browser_interface) { |   59                              PPB_GetInterface get_browser_interface) { | 
|   63   PDFModule* module = new PDFModule(); |   60   PDFModule* module = new PDFModule(); | 
|   64   if (!module->InternalInit(module_id, get_browser_interface)) { |   61   if (!module->InternalInit(module_id, get_browser_interface)) { | 
|   65     delete module; |   62     delete module; | 
|   66     return PP_ERROR_FAILED; |   63     return PP_ERROR_FAILED; | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  170       autorotate); |  167       autorotate); | 
|  171   bool ret = engine_exports->RenderPDFPageToBitmap( |  168   bool ret = engine_exports->RenderPDFPageToBitmap( | 
|  172       pdf_buffer, pdf_buffer_size, page_number, settings, bitmap_buffer); |  169       pdf_buffer, pdf_buffer_size, page_number, settings, bitmap_buffer); | 
|  173   if (!g_sdk_initialized_via_pepper) { |  170   if (!g_sdk_initialized_via_pepper) { | 
|  174     chrome_pdf::ShutdownSDK(); |  171     chrome_pdf::ShutdownSDK(); | 
|  175   } |  172   } | 
|  176   return ret; |  173   return ret; | 
|  177 } |  174 } | 
|  178  |  175  | 
|  179 }  // namespace chrome_pdf |  176 }  // namespace chrome_pdf | 
| OLD | NEW |