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

Side by Side Diff: xfa/fee/fde_txtedtbuf.cpp

Issue 1944093002: Cleanup XFA-Specific memory allocators. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Dan's comments, remove more unused methods. Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « xfa/fee/fde_txtedtbuf.h ('k') | xfa/fgas/crt/fgas_memory.h » ('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 #include "xfa/fee/fde_txtedtbuf.h" 7 #include "xfa/fee/fde_txtedtbuf.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 ASSERT(nChunkSize); 363 ASSERT(nChunkSize);
364 ASSERT(nDefChunkCount); 364 ASSERT(nDefChunkCount);
365 if (m_pAllocator) { 365 if (m_pAllocator) {
366 m_pAllocator->Release(); 366 m_pAllocator->Release();
367 m_pAllocator = NULL; 367 m_pAllocator = NULL;
368 } 368 }
369 m_Chunks.RemoveAll(); 369 m_Chunks.RemoveAll();
370 m_nChunkSize = nChunkSize; 370 m_nChunkSize = nChunkSize;
371 int32_t nChunkLength = 371 int32_t nChunkLength =
372 sizeof(FDE_CHUNKHEADER) + (m_nChunkSize - 1) * sizeof(FX_WCHAR); 372 sizeof(FDE_CHUNKHEADER) + (m_nChunkSize - 1) * sizeof(FX_WCHAR);
373 m_pAllocator = 373 m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Fixed, nDefChunkCount,
374 FX_CreateAllocator(FX_ALLOCTYPE_Fixed, nDefChunkCount, nChunkLength); 374 nChunkLength);
375 ASSERT(m_pAllocator);
376 FDE_CHUNKHEADER* lpChunkHeader = 375 FDE_CHUNKHEADER* lpChunkHeader =
377 static_cast<FDE_CHUNKHEADER*>(m_pAllocator->Alloc(nChunkLength)); 376 static_cast<FDE_CHUNKHEADER*>(m_pAllocator->Alloc(nChunkLength));
378 ASSERT(lpChunkHeader); 377 ASSERT(lpChunkHeader);
379 lpChunkHeader->nUsed = 0; 378 lpChunkHeader->nUsed = 0;
380 m_Chunks.Add(lpChunkHeader); 379 m_Chunks.Add(lpChunkHeader);
381 m_nTotal = 0; 380 m_nTotal = 0;
382 } 381 }
383 int32_t CFDE_TxtEdtBuf::CP2Index(const FDE_CHUNKPLACE& cp) const { 382 int32_t CFDE_TxtEdtBuf::CP2Index(const FDE_CHUNKPLACE& cp) const {
384 int32_t nTotal = cp.nCharIndex; 383 int32_t nTotal = cp.nCharIndex;
385 int32_t i = 0; 384 int32_t i = 0;
(...skipping 14 matching lines...) Expand all
400 int32_t nCount = m_Chunks.GetSize(); 399 int32_t nCount = m_Chunks.GetSize();
401 for (; i < nCount; i++) { 400 for (; i < nCount; i++) {
402 nTotal += m_Chunks[i]->nUsed; 401 nTotal += m_Chunks[i]->nUsed;
403 if (nTotal > nIndex) { 402 if (nTotal > nIndex) {
404 break; 403 break;
405 } 404 }
406 } 405 }
407 cp.nChunkIndex = i; 406 cp.nChunkIndex = i;
408 cp.nCharIndex = m_Chunks[i]->nUsed - (nTotal - nIndex); 407 cp.nCharIndex = m_Chunks[i]->nUsed - (nTotal - nIndex);
409 } 408 }
OLDNEW
« no previous file with comments | « xfa/fee/fde_txtedtbuf.h ('k') | xfa/fgas/crt/fgas_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698