Chromium Code Reviews| 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 <limits.h> | 5 #include <limits.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 | 79 |
| 80 struct AvailDeleter { | 80 struct AvailDeleter { |
| 81 inline void operator()(FPDF_AVAIL avail) const { FPDFAvail_Destroy(avail); } | 81 inline void operator()(FPDF_AVAIL avail) const { FPDFAvail_Destroy(avail); } |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 static FPDF_FORMFILLINFO_PDFiumTest* ToPDFiumTestFormFillInfo( | 84 static FPDF_FORMFILLINFO_PDFiumTest* ToPDFiumTestFormFillInfo( |
| 85 FPDF_FORMFILLINFO* formFillInfo) { | 85 FPDF_FORMFILLINFO* formFillInfo) { |
| 86 return static_cast<FPDF_FORMFILLINFO_PDFiumTest*>(formFillInfo); | 86 return static_cast<FPDF_FORMFILLINFO_PDFiumTest*>(formFillInfo); |
| 87 } | 87 } |
| 88 | 88 |
| 89 static void CloseDocAndForm(FPDF_DOCUMENT doc, FPDF_FORMHANDLE form) { | 89 static void CloseDocAndForm(FPDF_DOCUMENT doc, FPDF_FORMHANDLE form) { |
|
Lei Zhang
2016/10/05 17:14:54
If we end up here, just remove CloseDocAndForm() i
dsinclair
2016/10/05 17:55:57
Done.
| |
| 90 #ifdef PDF_ENABLE_XFA | |
| 91 // Note: The shut down order here is the reverse of the non-XFA branch order. | |
| 92 // Need to work out if this is required, and if it is, the lifetimes of | |
| 93 // objects owned by |doc| that |form| reference. | |
| 94 FPDF_CloseDocument(doc); | |
| 95 FPDFDOC_ExitFormFillEnvironment(form); | |
| 96 #else // PDF_ENABLE_XFA | |
| 97 FPDFDOC_ExitFormFillEnvironment(form); | 90 FPDFDOC_ExitFormFillEnvironment(form); |
| 98 FPDF_CloseDocument(doc); | 91 FPDF_CloseDocument(doc); |
| 99 #endif // PDF_ENABLE_XFA | |
| 100 } | 92 } |
| 101 | 93 |
| 102 static bool CheckDimensions(int stride, int width, int height) { | 94 static bool CheckDimensions(int stride, int width, int height) { |
| 103 if (stride < 0 || width < 0 || height < 0) | 95 if (stride < 0 || width < 0 || height < 0) |
| 104 return false; | 96 return false; |
| 105 if (height > 0 && width > INT_MAX / height) | 97 if (height > 0 && width > INT_MAX / height) |
| 106 return false; | 98 return false; |
| 107 return true; | 99 return true; |
| 108 } | 100 } |
| 109 | 101 |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 933 delete platform; | 925 delete platform; |
| 934 | 926 |
| 935 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 927 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 936 free(const_cast<char*>(natives.data)); | 928 free(const_cast<char*>(natives.data)); |
| 937 free(const_cast<char*>(snapshot.data)); | 929 free(const_cast<char*>(snapshot.data)); |
| 938 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 930 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
| 939 #endif // PDF_ENABLE_V8 | 931 #endif // PDF_ENABLE_V8 |
| 940 | 932 |
| 941 return 0; | 933 return 0; |
| 942 } | 934 } |
| OLD | NEW |