summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-09-28 22:06:20 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-28 22:06:20 -0700
commitaca4fc767d663e43d323b96a75804a8f5cafd8d4 (patch)
tree3e4e5c168af167ba6044c83431511b9a978773ed
parent3873f302948e37aad7066c8231575f486015cc34 (diff)
downloadpdfium-aca4fc767d663e43d323b96a75804a8f5cafd8d4.tar.xz
Replace a few more std::unique_ptr.reset() with WrapUnique assignments.
And fix a typo. TBR=tsepez@chromium.org Review-Url: https://codereview.chromium.org/2382443004
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_stream.h2
-rw-r--r--core/fxcrt/fx_xml_parser.cpp2
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp12
-rw-r--r--core/fxge/dib/fx_dib_engine.cpp6
-rw-r--r--core/fxge/dib/fx_dib_main.cpp12
-rw-r--r--core/fxge/dib/fx_dib_transform.cpp12
-rw-r--r--core/fxge/ge/cfx_font.cpp4
-rw-r--r--core/fxge/ge/cfx_fontmgr.cpp2
-rw-r--r--testing/js_embedder_test.cpp2
9 files changed, 27 insertions, 27 deletions
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_stream.h b/core/fpdfapi/fpdf_parser/include/cpdf_stream.h
index b39b20a1e9..69a612cc0c 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_stream.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_stream.h
@@ -18,7 +18,7 @@ class CPDF_Stream : public CPDF_Object {
public:
CPDF_Stream();
- // Takes onwership of |pData| and |pDict|.
+ // Takes ownership of |pData| and |pDict|.
CPDF_Stream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict);
// CPDF_Object.
diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp
index 9412cdde04..926196786a 100644
--- a/core/fxcrt/fx_xml_parser.cpp
+++ b/core/fxcrt/fx_xml_parser.cpp
@@ -894,7 +894,7 @@ void CXML_AttrMap::SetAt(const CFX_ByteString& space,
const CFX_ByteString& name,
const CFX_WideString& value) {
if (!m_pMap)
- m_pMap.reset(new std::vector<CXML_AttrItem>);
+ m_pMap = WrapUnique(new std::vector<CXML_AttrItem>);
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 6271c1097e..34d2a05d80 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -498,7 +498,7 @@ int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) const {
void CFX_AggDeviceDriver::SaveState() {
std::unique_ptr<CFX_ClipRgn> pClip;
if (m_pClipRgn)
- pClip.reset(new CFX_ClipRgn(*m_pClipRgn));
+ pClip = WrapUnique(new CFX_ClipRgn(*m_pClipRgn));
m_StateStack.push_back(std::move(pClip));
}
@@ -510,7 +510,7 @@ void CFX_AggDeviceDriver::RestoreState(bool bKeepSaved) {
if (bKeepSaved) {
if (m_StateStack.back())
- m_pClipRgn.reset(new CFX_ClipRgn(*m_StateStack.back()));
+ m_pClipRgn = WrapUnique(new CFX_ClipRgn(*m_StateStack.back()));
} else {
m_pClipRgn = std::move(m_StateStack.back());
m_StateStack.pop_back();
@@ -544,8 +544,8 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
int fill_mode) {
m_FillFlags = fill_mode;
if (!m_pClipRgn) {
- m_pClipRgn.reset(new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH),
- GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ m_pClipRgn = WrapUnique(new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH),
+ GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
}
if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) {
CFX_FloatRect rectf;
@@ -577,8 +577,8 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke(
const CFX_Matrix* pObject2Device,
const CFX_GraphStateData* pGraphState) {
if (!m_pClipRgn) {
- m_pClipRgn.reset(new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH),
- GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ m_pClipRgn = WrapUnique(new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH),
+ GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
}
CAgg_PathData path_data;
path_data.BuildPath(pPathData, nullptr);
diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp
index 7ba031e8aa..e8401d7663 100644
--- a/core/fxge/dib/fx_dib_engine.cpp
+++ b/core/fxge/dib/fx_dib_engine.cpp
@@ -930,9 +930,9 @@ FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) {
}
FX_BOOL CFX_ImageStretcher::StartStretch() {
- m_pStretchEngine.reset(new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth,
- m_DestHeight, m_ClipRect, m_pSource,
- m_Flags));
+ m_pStretchEngine = WrapUnique(
+ new CStretchEngine(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 16106fec7f..9575e6aac4 100644
--- a/core/fxge/dib/fx_dib_main.cpp
+++ b/core/fxge/dib/fx_dib_main.cpp
@@ -1461,7 +1461,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.reset(new CFX_DIBitmap);
+ m_pBitmap = WrapUnique(new CFX_DIBitmap);
if (!m_pBitmap->Create(pSrc->GetWidth(), pSrc->GetHeight(),
pSrc->GetFormat(), pSrc->GetBuffer())) {
m_pBitmap.reset();
@@ -1567,9 +1567,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.reset(new CFX_ImageStretcher(&m_Composer, pSource,
- dest_height, dest_width,
- bitmap_clip, dib_flags));
+ m_Stretcher = WrapUnique(new CFX_ImageStretcher(&m_Composer, pSource,
+ dest_height, dest_width,
+ bitmap_clip, dib_flags));
if (!m_Stretcher->Start())
return FALSE;
@@ -1600,7 +1600,7 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice,
FALSE, FALSE, FALSE, m_bRgbByteOrder, alpha_flag,
pIccTransform, m_BlendType);
m_Status = 1;
- m_Stretcher.reset(new CFX_ImageStretcher(
+ m_Stretcher = WrapUnique(new CFX_ImageStretcher(
&m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags));
return m_Stretcher->Start();
}
@@ -1680,7 +1680,7 @@ FX_BOOL CFX_BitmapStorer::SetInfo(int width,
int height,
FXDIB_Format src_format,
uint32_t* pSrcPalette) {
- m_pBitmap.reset(new CFX_DIBitmap);
+ m_pBitmap = WrapUnique(new CFX_DIBitmap);
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 73b02be210..27dbb82fab 100644
--- a/core/fxge/dib/fx_dib_transform.cpp
+++ b/core/fxge/dib/fx_dib_transform.cpp
@@ -363,8 +363,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.reset(new CFX_ImageStretcher(&m_Storer, m_pSrc, dest_height,
- dest_width, result_clip, m_Flags));
+ m_Stretcher = WrapUnique(new CFX_ImageStretcher(
+ &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags));
m_Stretcher->Start();
m_Status = 1;
return TRUE;
@@ -376,7 +376,7 @@ 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.reset(new CFX_ImageStretcher(
+ m_Stretcher = WrapUnique(new CFX_ImageStretcher(
&m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags));
m_Stretcher->Start();
m_Status = 2;
@@ -395,9 +395,9 @@ 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.reset(new CFX_ImageStretcher(&m_Storer, m_pSrc, stretch_width,
- stretch_height, m_StretchClip,
- m_Flags));
+ m_Stretcher = WrapUnique(new CFX_ImageStretcher(&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 ce77cbf661..a291b59ad4 100644
--- a/core/fxge/ge/cfx_font.cpp
+++ b/core/fxge/ge/cfx_font.cpp
@@ -244,7 +244,7 @@ FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
m_bShallowCopy = true;
if (pFont->m_pSubstFont) {
- m_pSubstFont.reset(new CFX_SubstFont);
+ m_pSubstFont = WrapUnique(new CFX_SubstFont);
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 +319,7 @@ void CFX_Font::LoadSubst(const CFX_ByteString& face_name,
bool bVertical) {
m_bEmbedded = false;
m_bVertical = bVertical;
- m_pSubstFont.reset(new CFX_SubstFont);
+ m_pSubstFont = WrapUnique(new CFX_SubstFont);
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 ec1d81b237..a3cc796a6d 100644
--- a/core/fxge/ge/cfx_fontmgr.cpp
+++ b/core/fxge/ge/cfx_fontmgr.cpp
@@ -81,7 +81,7 @@ int GetTTCIndex(const uint8_t* pFontData,
CFX_FontMgr::CFX_FontMgr()
: m_FTLibrary(nullptr), m_FTLibrarySupportsHinting(false) {
- m_pBuiltinMapper.reset(new CFX_FontMapper(this));
+ m_pBuiltinMapper = WrapUnique(new CFX_FontMapper(this));
}
CFX_FontMgr::~CFX_FontMgr() {
diff --git a/testing/js_embedder_test.cpp b/testing/js_embedder_test.cpp
index 125d2bff3e..a8b0d5bfcf 100644
--- a/testing/js_embedder_test.cpp
+++ b/testing/js_embedder_test.cpp
@@ -21,7 +21,7 @@ void JSEmbedderTest::SetUp() {
v8::Isolate::Scope isolate_scope(m_pIsolate);
v8::HandleScope handle_scope(m_pIsolate);
FXJS_PerIsolateData::SetUp(m_pIsolate);
- m_Engine.reset(new CFXJS_Engine(m_pIsolate));
+ m_Engine = WrapUnique(new CFXJS_Engine(m_pIsolate));
m_Engine->InitializeEngine();
}