From 36eb4bdcae719cf33c536ff72ac000482aed8382 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 3 Oct 2016 15:24:27 -0700 Subject: Add ptr_util.h from base until std::make_unique<> available Review-Url: https://codereview.chromium.org/2386273004 --- core/fpdfapi/fpdf_font/cpdf_font.cpp | 3 ++- core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 3 ++- core/fpdfapi/fpdf_parser/cfdf_document.cpp | 3 ++- core/fpdfapi/fpdf_parser/cpdf_document.cpp | 3 ++- core/fpdfdoc/cpdf_annot.cpp | 3 ++- core/fxcrt/fx_memory.h | 6 ------ core/fxcrt/fx_xml_parser.cpp | 3 ++- core/fxge/agg/fx_agg_driver.cpp | 21 +++++++++++---------- core/fxge/apple/fx_quartz_device.cpp | 5 +++-- core/fxge/dib/fx_dib_engine.cpp | 7 ++++--- core/fxge/dib/fx_dib_main.cpp | 15 ++++++++------- core/fxge/dib/fx_dib_transform.cpp | 14 +++++++------- core/fxge/ge/cfx_font.cpp | 5 +++-- core/fxge/ge/cfx_fontmgr.cpp | 3 ++- core/fxge/skia/fx_skia_device.cpp | 14 +++++++------- core/fxge/win32/fx_win32_device.cpp | 3 ++- 16 files changed, 59 insertions(+), 52 deletions(-) (limited to 'core') diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp index 9b6fc5e824..96ebda740a 100644 --- a/core/fpdfapi/fpdf_font/cpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp @@ -24,6 +24,7 @@ #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" #include "core/fxcrt/fx_memory.h" #include "core/fxge/fx_freetype.h" +#include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" namespace { @@ -454,7 +455,7 @@ const FX_CHAR* CPDF_Font::GetAdobeCharName( uint32_t CPDF_Font::FallbackFontFromCharcode(uint32_t charcode) { if (m_FontFallbacks.empty()) { - m_FontFallbacks.push_back(WrapUnique(new CFX_Font())); + m_FontFallbacks.push_back(pdfium::MakeUnique()); m_FontFallbacks[0]->LoadSubst("Arial", IsTrueTypeFont(), m_Flags, m_StemV * 5, m_ItalicAngle, 0, IsVertWriting()); diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 4fc4bdc934..5356e1f5b5 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -36,6 +36,7 @@ #include "core/fxcrt/fx_safe_types.h" #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" +#include "third_party/base/ptr_util.h" namespace { @@ -790,7 +791,7 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, pImageObj->SetUnownedImage(m_pDocument->LoadImageF(pStream)); } else { pImageObj->SetOwnedImage( - WrapUnique(new CPDF_Image(m_pDocument, pStream, bInline))); + pdfium::MakeUnique(m_pDocument, pStream, bInline)); } SetGraphicStates(pImageObj.get(), pImageObj->GetImage()->IsMask(), FALSE, FALSE); diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp index 3721bf885b..c8ed9edada 100644 --- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp @@ -9,13 +9,14 @@ #include "core/fpdfapi/fpdf_edit/cpdf_creator.h" #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" +#include "third_party/base/ptr_util.h" CFDF_Document::CFDF_Document() : CPDF_IndirectObjectHolder(), m_pRootDict(nullptr), m_pFile(nullptr), m_bOwnFile(FALSE), - m_pByteStringPool(WrapUnique(new CFX_ByteStringPool)) {} + m_pByteStringPool(pdfium::MakeUnique()) {} CFDF_Document::~CFDF_Document() { if (m_bOwnFile && m_pFile) diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp index f8b4f9b87b..75e6a84598 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp @@ -23,6 +23,7 @@ #include "core/fxcodec/JBig2_DocumentContext.h" #include "core/fxge/cfx_unicodeencoding.h" #include "core/fxge/fx_font.h" +#include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" namespace { @@ -415,7 +416,7 @@ CPDF_Document::CPDF_Document(std::unique_ptr pParser) m_dwFirstPageObjNum(0), m_pDocPage(new CPDF_DocPageData(this)), m_pDocRender(new CPDF_DocRenderData(this)), - m_pByteStringPool(WrapUnique(new CFX_ByteStringPool)) { + m_pByteStringPool(pdfium::MakeUnique()) { if (pParser) SetLastObjNum(m_pParser->GetLastObjNum()); } diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index 3df5ca5144..c2297ac3df 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -17,6 +17,7 @@ #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" +#include "third_party/base/ptr_util.h" namespace { @@ -183,7 +184,7 @@ CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) { CPDF_Form* pNewForm = new CPDF_Form(m_pDocument, pPage->m_pResources, pStream); pNewForm->ParseContent(nullptr, nullptr, nullptr); - m_APMap[pStream] = WrapUnique(pNewForm); + m_APMap[pStream] = pdfium::WrapUnique(pNewForm); return pNewForm; } diff --git a/core/fxcrt/fx_memory.h b/core/fxcrt/fx_memory.h index beb194fbda..0ad28ce896 100644 --- a/core/fxcrt/fx_memory.h +++ b/core/fxcrt/fx_memory.h @@ -101,12 +101,6 @@ struct ReleaseDeleter { inline void operator()(T* ptr) const { ptr->Release(); } }; -// Used to help transfer ownership of a raw pointer to std::unique_ptr. -template -std::unique_ptr WrapUnique(T* ptr) { - return std::unique_ptr(ptr); -} - #endif // __cplusplus #endif // CORE_FXCRT_FX_MEMORY_H_ diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp index a7026e9bb1..563e1c961b 100644 --- a/core/fxcrt/fx_xml_parser.cpp +++ b/core/fxcrt/fx_xml_parser.cpp @@ -10,6 +10,7 @@ #include "core/fxcrt/fx_ext.h" #include "core/fxcrt/fx_xml.h" +#include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" CXML_DataBufAcc::CXML_DataBufAcc(const uint8_t* pBuffer, size_t size) @@ -894,7 +895,7 @@ void CXML_AttrMap::SetAt(const CFX_ByteString& space, const CFX_ByteString& name, const CFX_WideString& value) { if (!m_pMap) - m_pMap = WrapUnique(new std::vector); + m_pMap = pdfium::MakeUnique>(); for (CXML_AttrItem& item : *m_pMap) { if (item.Matches(space, name)) { diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 4f9c85c8a9..d3be763def 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -27,6 +27,7 @@ #include "third_party/agg23/agg_rasterizer_scanline_aa.h" #include "third_party/agg23/agg_renderer_scanline.h" #include "third_party/agg23/agg_scanline_u.h" +#include "third_party/base/ptr_util.h" namespace { @@ -498,7 +499,7 @@ int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) const { void CFX_AggDeviceDriver::SaveState() { std::unique_ptr pClip; if (m_pClipRgn) - pClip = WrapUnique(new CFX_ClipRgn(*m_pClipRgn)); + pClip = pdfium::MakeUnique(*m_pClipRgn); m_StateStack.push_back(std::move(pClip)); } @@ -510,7 +511,7 @@ void CFX_AggDeviceDriver::RestoreState(bool bKeepSaved) { if (bKeepSaved) { if (m_StateStack.back()) - m_pClipRgn = WrapUnique(new CFX_ClipRgn(*m_StateStack.back())); + m_pClipRgn = pdfium::MakeUnique(*m_StateStack.back()); } else { m_pClipRgn = std::move(m_StateStack.back()); m_StateStack.pop_back(); @@ -544,8 +545,8 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, int fill_mode) { m_FillFlags = fill_mode; if (!m_pClipRgn) { - m_pClipRgn = WrapUnique(new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), - GetDeviceCaps(FXDC_PIXEL_HEIGHT))); + m_pClipRgn = pdfium::MakeUnique( + GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); } if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { CFX_FloatRect rectf; @@ -577,8 +578,8 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke( const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState) { if (!m_pClipRgn) { - m_pClipRgn = WrapUnique(new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), - GetDeviceCaps(FXDC_PIXEL_HEIGHT))); + m_pClipRgn = pdfium::MakeUnique( + GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); } CAgg_PathData path_data; path_data.BuildPath(pPathData, nullptr); @@ -1735,8 +1736,8 @@ bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, return false; SetBitmap(pBitmap); - SetDeviceDriver(WrapUnique(new CFX_AggDeviceDriver( - pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout))); + SetDeviceDriver(pdfium::MakeUnique( + pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout)); return true; } @@ -1751,8 +1752,8 @@ bool CFX_FxgeDevice::Create(int width, return false; } SetBitmap(pBitmap); - SetDeviceDriver( - WrapUnique(new CFX_AggDeviceDriver(pBitmap, FALSE, pOriDevice, FALSE))); + SetDeviceDriver(pdfium::MakeUnique(pBitmap, FALSE, + pOriDevice, FALSE)); return true; } diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index d3520d7257..74a03649dd 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp @@ -18,6 +18,7 @@ #include "core/fxge/dib/dib_int.h" #include "core/fxge/fx_freetype.h" #include "core/fxge/ge/fx_text_int.h" +#include "third_party/base/ptr_util.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ #include "core/fxge/apple/apple_int.h" @@ -1021,7 +1022,7 @@ FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) { m_pContext = context; CGContextRetain(m_pContext); SetDeviceDriver( - WrapUnique(new CFX_QuartzDeviceDriver(m_pContext, nDeviceClass))); + pdfium::MakeUnique(m_pContext, nDeviceClass)); return TRUE; } @@ -1032,7 +1033,7 @@ FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) { return FALSE; SetDeviceDriver( - WrapUnique(new CFX_QuartzDeviceDriver(m_pContext, FXDC_DISPLAY))); + pdfium::MakeUnique(m_pContext, FXDC_DISPLAY)); return TRUE; } diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp index c8e9558888..389cf23909 100644 --- a/core/fxge/dib/fx_dib_engine.cpp +++ b/core/fxge/dib/fx_dib_engine.cpp @@ -10,6 +10,7 @@ #include "core/fxge/dib/dib_int.h" #include "core/fxge/fx_dib.h" +#include "third_party/base/ptr_util.h" namespace { @@ -930,9 +931,9 @@ FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) { } FX_BOOL CFX_ImageStretcher::StartStretch() { - m_pStretchEngine = WrapUnique( - new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, - m_ClipRect, m_pSource, m_Flags)); + m_pStretchEngine = pdfium::MakeUnique( + m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource, + m_Flags); m_pStretchEngine->StartStretchHorz(); if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) { m_pStretchEngine->Continue(nullptr); diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp index 14cd0f4da6..df448a66bd 100644 --- a/core/fxge/dib/fx_dib_main.cpp +++ b/core/fxge/dib/fx_dib_main.cpp @@ -13,6 +13,7 @@ #include "core/fxge/cfx_gemodule.h" #include "core/fxge/dib/dib_int.h" #include "core/fxge/ge/cfx_cliprgn.h" +#include "third_party/base/ptr_util.h" void CmykDecode(uint32_t cmyk, int& c, int& m, int& y, int& k) { c = FXSYS_GetCValue(cmyk); @@ -1461,7 +1462,7 @@ CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const { CFX_DIBExtractor::CFX_DIBExtractor(const CFX_DIBSource* pSrc) { if (pSrc->GetBuffer()) { - m_pBitmap = WrapUnique(new CFX_DIBitmap); + m_pBitmap = pdfium::MakeUnique(); if (!m_pBitmap->Create(pSrc->GetWidth(), pSrc->GetHeight(), pSrc->GetFormat(), pSrc->GetBuffer())) { m_pBitmap.reset(); @@ -1567,9 +1568,9 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox, TRUE, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder, alpha_flag, pIccTransform, m_BlendType); - m_Stretcher = WrapUnique(new CFX_ImageStretcher(&m_Composer, pSource, - dest_height, dest_width, - bitmap_clip, dib_flags)); + m_Stretcher = pdfium::MakeUnique( + &m_Composer, pSource, dest_height, dest_width, bitmap_clip, + dib_flags); if (!m_Stretcher->Start()) return FALSE; @@ -1600,8 +1601,8 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, FALSE, FALSE, FALSE, m_bRgbByteOrder, alpha_flag, pIccTransform, m_BlendType); m_Status = 1; - m_Stretcher = WrapUnique(new CFX_ImageStretcher( - &m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags)); + m_Stretcher = pdfium::MakeUnique( + &m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags); return m_Stretcher->Start(); } @@ -1680,7 +1681,7 @@ FX_BOOL CFX_BitmapStorer::SetInfo(int width, int height, FXDIB_Format src_format, uint32_t* pSrcPalette) { - m_pBitmap = WrapUnique(new CFX_DIBitmap); + m_pBitmap = pdfium::MakeUnique(); if (!m_pBitmap->Create(width, height, src_format)) { m_pBitmap.reset(); return FALSE; diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp index a559fee55d..559c6e2a38 100644 --- a/core/fxge/dib/fx_dib_transform.cpp +++ b/core/fxge/dib/fx_dib_transform.cpp @@ -7,6 +7,7 @@ #include "core/fxge/dib/dib_int.h" #include "core/fxge/fx_dib.h" +#include "third_party/base/ptr_util.h" namespace { @@ -363,8 +364,8 @@ FX_BOOL CFX_ImageTransformer::Start() { result_clip.Offset(-result_rect.left, -result_rect.top); result_clip = FXDIB_SwapClipBox(result_clip, dest_width, dest_height, m_pMatrix->c > 0, m_pMatrix->b < 0); - m_Stretcher = WrapUnique(new CFX_ImageStretcher( - &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags)); + m_Stretcher = pdfium::MakeUnique( + &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags); m_Stretcher->Start(); m_Status = 1; return TRUE; @@ -376,8 +377,8 @@ FX_BOOL CFX_ImageTransformer::Start() { int dest_height = m_pMatrix->d > 0 ? (int)-FXSYS_ceil(m_pMatrix->d) : (int)-FXSYS_floor(m_pMatrix->d); result_clip.Offset(-result_rect.left, -result_rect.top); - m_Stretcher = WrapUnique(new CFX_ImageStretcher( - &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags)); + m_Stretcher = pdfium::MakeUnique( + &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags); m_Stretcher->Start(); m_Status = 2; return TRUE; @@ -395,9 +396,8 @@ FX_BOOL CFX_ImageTransformer::Start() { clip_rect_f.Transform(&m_dest2stretch); m_StretchClip = clip_rect_f.GetOuterRect(); m_StretchClip.Intersect(0, 0, stretch_width, stretch_height); - m_Stretcher = WrapUnique(new CFX_ImageStretcher(&m_Storer, m_pSrc, - stretch_width, stretch_height, - m_StretchClip, m_Flags)); + m_Stretcher = pdfium::MakeUnique( + &m_Storer, m_pSrc, stretch_width, stretch_height, m_StretchClip, m_Flags); m_Stretcher->Start(); m_Status = 3; return TRUE; diff --git a/core/fxge/ge/cfx_font.cpp b/core/fxge/ge/cfx_font.cpp index 737d7c450b..e957b219f4 100644 --- a/core/fxge/ge/cfx_font.cpp +++ b/core/fxge/ge/cfx_font.cpp @@ -15,6 +15,7 @@ #include "core/fxge/cfx_substfont.h" #include "core/fxge/fx_freetype.h" #include "core/fxge/ge/fx_text_int.h" +#include "third_party/base/ptr_util.h" #define EM_ADJUST(em, a) (em == 0 ? (a) : (a)*1000 / em) @@ -244,7 +245,7 @@ FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) { m_bShallowCopy = true; if (pFont->m_pSubstFont) { - m_pSubstFont = WrapUnique(new CFX_SubstFont); + m_pSubstFont = pdfium::MakeUnique(); m_pSubstFont->m_Charset = pFont->m_pSubstFont->m_Charset; m_pSubstFont->m_SubstFlags = pFont->m_pSubstFont->m_SubstFlags; m_pSubstFont->m_Weight = pFont->m_pSubstFont->m_Weight; @@ -319,7 +320,7 @@ void CFX_Font::LoadSubst(const CFX_ByteString& face_name, bool bVertical) { m_bEmbedded = false; m_bVertical = bVertical; - m_pSubstFont = WrapUnique(new CFX_SubstFont); + m_pSubstFont = pdfium::MakeUnique(); m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont( face_name, bTrueType, flags, weight, italic_angle, CharsetCP, m_pSubstFont.get()); diff --git a/core/fxge/ge/cfx_fontmgr.cpp b/core/fxge/ge/cfx_fontmgr.cpp index 54000e6b5d..95a2b662ed 100644 --- a/core/fxge/ge/cfx_fontmgr.cpp +++ b/core/fxge/ge/cfx_fontmgr.cpp @@ -12,6 +12,7 @@ #include "core/fxge/fx_font.h" #include "core/fxge/ge/cttfontdesc.h" #include "core/fxge/ifx_systemfontinfo.h" +#include "third_party/base/ptr_util.h" namespace { @@ -81,7 +82,7 @@ int GetTTCIndex(const uint8_t* pFontData, CFX_FontMgr::CFX_FontMgr() : m_FTLibrary(nullptr), m_FTLibrarySupportsHinting(false) { - m_pBuiltinMapper = WrapUnique(new CFX_FontMapper(this)); + m_pBuiltinMapper = pdfium::MakeUnique(this); } CFX_FontMgr::~CFX_FontMgr() { diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 6a492dd074..928b56fa61 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -20,7 +20,7 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/skia/fx_skia_device.h" - +#include "third_party/base/ptr_util.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColorFilter.h" #include "third_party/skia/include/core/SkColorPriv.h" @@ -1586,7 +1586,7 @@ void CFX_FxgeDevice::Clear(uint32_t color) { SkPictureRecorder* CFX_FxgeDevice::CreateRecorder(int size_x, int size_y) { CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y); - SetDeviceDriver(WrapUnique(skDriver)); + SetDeviceDriver(pdfium::WrapUnique(skDriver)); return skDriver->GetRecorder(); } @@ -1597,15 +1597,15 @@ bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, if (!pBitmap) return false; SetBitmap(pBitmap); - SetDeviceDriver(WrapUnique(new CFX_SkiaDeviceDriver( - pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout))); + SetDeviceDriver(pdfium::MakeUnique( + pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout)); return true; } bool CFX_FxgeDevice::AttachRecorder(SkPictureRecorder* recorder) { if (!recorder) return false; - SetDeviceDriver(WrapUnique(new CFX_SkiaDeviceDriver(recorder))); + SetDeviceDriver(pdfium::MakeUnique(recorder)); return true; } @@ -1620,8 +1620,8 @@ bool CFX_FxgeDevice::Create(int width, return false; } SetBitmap(pBitmap); - SetDeviceDriver( - WrapUnique(new CFX_SkiaDeviceDriver(pBitmap, FALSE, pOriDevice, FALSE))); + SetDeviceDriver(pdfium::MakeUnique(pBitmap, FALSE, + pOriDevice, FALSE)); return true; } diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index f0eb2dbce2..bc6817da63 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -27,6 +27,7 @@ #include "core/fxge/win32/cfx_windowsdib.h" #include "core/fxge/win32/dwrite_int.h" #include "core/fxge/win32/win32_int.h" +#include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #ifndef _SKIA_SUPPORT_ @@ -1369,7 +1370,7 @@ FX_BOOL CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap, } CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC) { - SetDeviceDriver(WrapUnique(CreateDriver(hDC))); + SetDeviceDriver(pdfium::WrapUnique(CreateDriver(hDC))); } CFX_WindowsDevice::~CFX_WindowsDevice() {} -- cgit v1.2.3