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

Side by Side Diff: core/src/fxcrt/extension.h

Issue 1398383002: core/ difference with XFA (for information only). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 2015-11-24 version Created 5 years 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 | « core/src/fxcodec/codec/fx_codec_jpeg.cpp ('k') | core/src/fxcrt/fx_basic_buffer.cpp » ('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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_SRC_FXCRT_EXTENSION_H_ 7 #ifndef CORE_SRC_FXCRT_EXTENSION_H_
8 #define CORE_SRC_FXCRT_EXTENSION_H_ 8 #define CORE_SRC_FXCRT_EXTENSION_H_
9 9
10 #include "core/include/fxcrt/fx_basic.h" 10 #include "core/include/fxcrt/fx_basic.h"
(...skipping 13 matching lines...) Expand all
24 virtual size_t Write(const void* pBuffer, size_t szBuffer) = 0; 24 virtual size_t Write(const void* pBuffer, size_t szBuffer) = 0;
25 virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) = 0; 25 virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) = 0;
26 virtual size_t WritePos(const void* pBuffer, 26 virtual size_t WritePos(const void* pBuffer,
27 size_t szBuffer, 27 size_t szBuffer,
28 FX_FILESIZE pos) = 0; 28 FX_FILESIZE pos) = 0;
29 virtual FX_BOOL Flush() = 0; 29 virtual FX_BOOL Flush() = 0;
30 virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0; 30 virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0;
31 }; 31 };
32 IFXCRT_FileAccess* FXCRT_FileAccess_Create(); 32 IFXCRT_FileAccess* FXCRT_FileAccess_Create();
33 33
34 #ifdef PDF_ENABLE_XFA
35 class CFX_CRTFileAccess : public IFX_FileAccess {
36 public:
37 CFX_CRTFileAccess() : m_RefCount(0) {}
38
39 // IFX_FileAccess
40 void Release() override {
41 if (--m_RefCount == 0)
42 delete this;
43 }
44
45 IFX_FileAccess* Retain() override {
46 m_RefCount++;
47 return (IFX_FileAccess*)this;
48 }
49
50 void GetPath(CFX_WideString& wsPath) override { wsPath = m_path; }
51
52 IFX_FileStream* CreateFileStream(FX_DWORD dwModes) override {
53 return FX_CreateFileStream(m_path, dwModes);
54 }
55
56 FX_BOOL Init(const CFX_WideStringC& wsPath) {
57 m_path = wsPath;
58 m_RefCount = 1;
59 return TRUE;
60 }
61
62 protected:
63 CFX_WideString m_path;
64 FX_DWORD m_RefCount;
65 };
66
67 #endif
34 class CFX_CRTFileStream final : public IFX_FileStream { 68 class CFX_CRTFileStream final : public IFX_FileStream {
35 public: 69 public:
36 CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1) {} 70 CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1) {}
37 ~CFX_CRTFileStream() override { 71 ~CFX_CRTFileStream() override {
38 if (m_pFile) { 72 if (m_pFile) {
39 m_pFile->Release(); 73 m_pFile->Release();
40 } 74 }
41 } 75 }
42 virtual IFX_FileStream* Retain() override { 76 virtual IFX_FileStream* Retain() override {
43 m_dwCount++; 77 m_dwCount++;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } FX_MTRANDOMCONTEXT, *FX_LPMTRANDOMCONTEXT; 343 } FX_MTRANDOMCONTEXT, *FX_LPMTRANDOMCONTEXT;
310 typedef FX_MTRANDOMCONTEXT const* FX_LPCMTRANDOMCONTEXT; 344 typedef FX_MTRANDOMCONTEXT const* FX_LPCMTRANDOMCONTEXT;
311 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 345 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
312 FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount); 346 FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount);
313 #endif 347 #endif
314 #ifdef __cplusplus 348 #ifdef __cplusplus
315 } 349 }
316 #endif 350 #endif
317 351
318 #endif // CORE_SRC_FXCRT_EXTENSION_H_ 352 #endif // CORE_SRC_FXCRT_EXTENSION_H_
OLDNEW
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_jpeg.cpp ('k') | core/src/fxcrt/fx_basic_buffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698