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

Unified Diff: core/src/fxcrt/fx_extension.cpp

Issue 372473003: Remove custom memory manager (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Change malloc to calloc Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxcrt/fx_basic_wstring.cpp ('k') | core/src/fxcrt/fx_xml_composer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcrt/fx_extension.cpp
diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp
index e7272cff0b69d3e960f4118b1049f459bcb08055..7ff6b062b40dd2357340c4573178c637256cf6a7 100644
--- a/core/src/fxcrt/fx_extension.cpp
+++ b/core/src/fxcrt/fx_extension.cpp
@@ -1,7 +1,7 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../include/fxcrt/fx_ext.h"
@@ -11,29 +11,29 @@
#else
#include <ctime>
#endif
-FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode, IFX_Allocator* pAllocator)
+FX_HFILE FX_File_Open(FX_BSTR fileName, FX_DWORD dwMode)
{
- IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(pAllocator);
+ IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create();
if (pFA && !pFA->Open(fileName, dwMode)) {
- pFA->Release(pAllocator);
+ pFA->Release();
return NULL;
}
return (FX_HFILE)pFA;
}
-FX_HFILE FX_File_Open(FX_WSTR fileName, FX_DWORD dwMode, IFX_Allocator* pAllocator)
+FX_HFILE FX_File_Open(FX_WSTR fileName, FX_DWORD dwMode)
{
- IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(pAllocator);
+ IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create();
if (pFA && !pFA->Open(fileName, dwMode)) {
- pFA->Release(pAllocator);
+ pFA->Release();
return NULL;
}
return (FX_HFILE)pFA;
}
-void FX_File_Close(FX_HFILE hFile, IFX_Allocator* pAllocator)
+void FX_File_Close(FX_HFILE hFile)
{
FXSYS_assert(hFile != NULL);
((IFXCRT_FileAccess*)hFile)->Close();
- ((IFXCRT_FileAccess*)hFile)->Release(pAllocator);
+ ((IFXCRT_FileAccess*)hFile)->Release();
}
FX_FILESIZE FX_File_GetSize(FX_HFILE hFile)
{
@@ -80,69 +80,53 @@ FX_BOOL FX_File_Truncate(FX_HFILE hFile, FX_FILESIZE szFile)
FXSYS_assert(hFile != NULL);
return ((IFXCRT_FileAccess*)hFile)->Truncate(szFile);
}
-IFX_FileStream* FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes, IFX_Allocator* pAllocator)
+IFX_FileStream* FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes)
{
- IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(pAllocator);
+ IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create();
if (!pFA) {
return NULL;
}
if (!pFA->Open(filename, dwModes)) {
- pFA->Release(pAllocator);
+ pFA->Release();
return NULL;
}
- if (pAllocator) {
- return FX_NewAtAllocator(pAllocator) CFX_CRTFileStream(pFA, pAllocator);
- } else {
- return FX_NEW CFX_CRTFileStream(pFA, pAllocator);
- }
+ return FX_NEW CFX_CRTFileStream(pFA);
}
-IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes, IFX_Allocator* pAllocator)
+IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes)
{
- IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(pAllocator);
+ IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create();
if (!pFA) {
return NULL;
}
if (!pFA->Open(filename, dwModes)) {
- pFA->Release(pAllocator);
+ pFA->Release();
return NULL;
}
- if (pAllocator) {
- return FX_NewAtAllocator(pAllocator) CFX_CRTFileStream(pFA, pAllocator);
- } else {
- return FX_NEW CFX_CRTFileStream(pFA, pAllocator);
- }
+ return FX_NEW CFX_CRTFileStream(pFA);
}
-IFX_FileWrite* FX_CreateFileWrite(FX_LPCSTR filename, IFX_Allocator* pAllocator)
+IFX_FileWrite* FX_CreateFileWrite(FX_LPCSTR filename)
{
- return FX_CreateFileStream(filename, FX_FILEMODE_Truncate, pAllocator);
+ return FX_CreateFileStream(filename, FX_FILEMODE_Truncate);
}
-IFX_FileWrite* FX_CreateFileWrite(FX_LPCWSTR filename, IFX_Allocator* pAllocator)
+IFX_FileWrite* FX_CreateFileWrite(FX_LPCWSTR filename)
{
- return FX_CreateFileStream(filename, FX_FILEMODE_Truncate, pAllocator);
+ return FX_CreateFileStream(filename, FX_FILEMODE_Truncate);
}
-IFX_FileRead* FX_CreateFileRead(FX_LPCSTR filename, IFX_Allocator* pAllocator)
+IFX_FileRead* FX_CreateFileRead(FX_LPCSTR filename)
{
- return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly, pAllocator);
+ return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly);
}
-IFX_FileRead* FX_CreateFileRead(FX_LPCWSTR filename, IFX_Allocator* pAllocator)
+IFX_FileRead* FX_CreateFileRead(FX_LPCWSTR filename)
{
- return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly, pAllocator);
+ return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly);
}
-IFX_MemoryStream* FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t dwSize, FX_BOOL bTakeOver, IFX_Allocator* pAllocator)
+IFX_MemoryStream* FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t dwSize, FX_BOOL bTakeOver)
{
- if (pAllocator) {
- return FX_NewAtAllocator(pAllocator)CFX_MemoryStream(pBuffer, dwSize, bTakeOver, pAllocator);
- } else {
- return FX_NEW CFX_MemoryStream(pBuffer, dwSize, bTakeOver, NULL);
- }
+ return FX_NEW CFX_MemoryStream(pBuffer, dwSize, bTakeOver);
}
-IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive, IFX_Allocator* pAllocator)
+IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive)
{
- if (pAllocator) {
- return FX_NewAtAllocator(pAllocator)CFX_MemoryStream(bConsecutive, pAllocator);
- } else {
- return FX_NEW CFX_MemoryStream(bConsecutive, NULL);
- }
+ return FX_NEW CFX_MemoryStream(bConsecutive);
}
#ifdef __cplusplus
extern "C" {
« no previous file with comments | « core/src/fxcrt/fx_basic_wstring.cpp ('k') | core/src/fxcrt/fx_xml_composer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698