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

Unified Diff: xfa/fwl/basewidget/fwl_editimp.cpp

Issue 1960673003: Replace some calls to Release() with direct delete, part 1. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Add unique ptrs 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 side-by-side diff with in-line comments
Download patch
Index: xfa/fwl/basewidget/fwl_editimp.cpp
diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp
index e47fb1b7395587566808b03c074606766e82f161..9f80336efa9b3ef88f184dde3abd5189b47cdd80 100644
--- a/xfa/fwl/basewidget/fwl_editimp.cpp
+++ b/xfa/fwl/basewidget/fwl_editimp.cpp
@@ -7,6 +7,7 @@
#include "xfa/fwl/basewidget/fwl_editimp.h"
#include <algorithm>
+#include <memory>
#include <vector>
#include "xfa/fde/fde_gedevice.h"
@@ -1082,13 +1083,13 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
CFX_RenderDevice* pRenderDev = pGraphics->GetRenderDevice();
if (!pRenderDev)
return;
- CFDE_RenderDevice* pRenderDevice = new CFDE_RenderDevice(pRenderDev, FALSE);
- CFDE_RenderContext* pRenderContext = new CFDE_RenderContext;
+
+ std::unique_ptr<CFDE_RenderDevice> pRenderDevice(
+ new CFDE_RenderDevice(pRenderDev, FALSE));
+ std::unique_ptr<CFDE_RenderContext> pRenderContext(new CFDE_RenderContext);
pRenderDevice->SetClipRect(rtClip);
- pRenderContext->StartRender(pRenderDevice, pPage, mt);
- pRenderContext->DoRender(NULL);
- pRenderContext->Release();
- pRenderDevice->Release();
+ pRenderContext->StartRender(pRenderDevice.get(), pPage, mt);
+ pRenderContext->DoRender(nullptr);
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_CombText) {
pGraphics->RestoreGraphState();
CFX_Path path;
@@ -1110,6 +1111,7 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
}
pGraphics->RestoreGraphState();
}
+
void CFWL_EditImp::UpdateEditEngine() {
UpdateEditParams();
UpdateEditLayout();

Powered by Google App Engine
This is Rietveld 408576698