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 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 | 49 |
50 BOOL APIENTRY DllMain(HMODULE module, DWORD reason_for_call, LPVOID reserved) { | 50 BOOL APIENTRY DllMain(HMODULE module, DWORD reason_for_call, LPVOID reserved) { |
51 g_hmodule = module; | 51 g_hmodule = module; |
52 if (reason_for_call == DLL_PROCESS_ATTACH) { | 52 if (reason_for_call == DLL_PROCESS_ATTACH) { |
53 // On windows following handlers work only inside module. So breakpad in | 53 // On windows following handlers work only inside module. So breakpad in |
54 // chrome.dll does not catch that. To avoid linking related code or | 54 // chrome.dll does not catch that. To avoid linking related code or |
55 // duplication breakpad_win.cc::InitCrashReporter() just catch errors here | 55 // duplication breakpad_win.cc::InitCrashReporter() just catch errors here |
56 // and crash in a way interceptable by breakpad of parent module. | 56 // and crash in a way interceptable by breakpad of parent module. |
57 _set_invalid_parameter_handler(HandleInvalidParameter); | 57 _set_invalid_parameter_handler(HandleInvalidParameter); |
58 _set_purecall_handler(HandlePureVirtualCall); | 58 _set_purecall_handler(HandlePureVirtualCall); |
59 | |
60 #if defined(ARCH_CPU_X86_64) && _MSC_VER <= 1800 | |
61 // VS2013's CRT only checks the existence of FMA3 instructions, not the | |
62 // enabled-ness of them at the OS level (this is fixed in VS2015). We force | |
63 // off usage of FMA3 instructions in the CRT to avoid using that path and | |
64 // hitting illegal instructions when running on CPUs that support FMA3, but | |
65 // OSs that don't. Because we use the static library CRT we have to call | |
66 // this function once in each DLL. | |
67 // See http://crbug.com/436603. | |
68 _set_FMA3_enable(0); | |
69 #endif // ARCH_CPU_X86_64 | |
Lei Zhang
2014/12/11 19:27:28
nit: should match #if
| |
59 } | 70 } |
60 return TRUE; | 71 return TRUE; |
61 } | 72 } |
62 | 73 |
63 #endif | 74 #endif |
64 | 75 |
65 namespace pp { | 76 namespace pp { |
66 | 77 |
67 PDF_USED Module* CreateModule() { | 78 PDF_USED Module* CreateModule() { |
68 return new chrome_pdf::PDFModule(); | 79 return new chrome_pdf::PDFModule(); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 autorotate); | 277 autorotate); |
267 bool ret = engine_exports->RenderPDFPageToBitmap( | 278 bool ret = engine_exports->RenderPDFPageToBitmap( |
268 pdf_buffer, pdf_buffer_size, page_number, settings, bitmap_buffer); | 279 pdf_buffer, pdf_buffer_size, page_number, settings, bitmap_buffer); |
269 if (!g_sdk_initialized_via_pepper) { | 280 if (!g_sdk_initialized_via_pepper) { |
270 chrome_pdf::ShutdownSDK(); | 281 chrome_pdf::ShutdownSDK(); |
271 } | 282 } |
272 return ret; | 283 return ret; |
273 } | 284 } |
274 | 285 |
275 } // extern "C" | 286 } // extern "C" |
OLD | NEW |