summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@chromium.org>2014-09-08 21:33:46 -0700
committerVitaly Buka <vitalybuka@chromium.org>2014-09-09 04:37:04 +0000
commite12ae0b0a1e9d18c585e63c37b51be7cef404772 (patch)
tree75f10eadb415041f2b79582753b8a33cd6407578 /printing
parent19378d2ee458f4ef60cf80cbe1cb81db22bdabde (diff)
downloadchromium_src-e12ae0b0a1e9d18c585e63c37b51be7cef404772.zip
chromium_src-e12ae0b0a1e9d18c585e63c37b51be7cef404772.tar.gz
chromium_src-e12ae0b0a1e9d18c585e63c37b51be7cef404772.tar.bz2
Delete temporarily dir for PDF to EMF conversion after EMF files closed.
printing::Emf keeps files locked so base::ScopedTempDir can't delete them and leaks files. Failures or crashes still may leak files. I ignore them to have change simple enough for merging into beta. BUG=411681 NOTRY=true R=scottmg@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/547203002 Cr-Commit-Position: refs/heads/master@{#293848}
Diffstat (limited to 'printing')
-rw-r--r--printing/emf_win.cc5
-rw-r--r--printing/emf_win.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/printing/emf_win.cc b/printing/emf_win.cc
index d9472f9..b6c9b4f 100644
--- a/printing/emf_win.cc
+++ b/printing/emf_win.cc
@@ -169,9 +169,14 @@ Emf::Emf() : emf_(NULL), hdc_(NULL), page_count_(0) {
}
Emf::~Emf() {
+ Close();
+}
+
+void Emf::Close() {
DCHECK(!hdc_);
if (emf_)
DeleteEnhMetaFile(emf_);
+ emf_ = NULL;
}
bool Emf::InitToFile(const base::FilePath& metafile_path) {
diff --git a/printing/emf_win.h b/printing/emf_win.h
index fa27409..e31e204 100644
--- a/printing/emf_win.h
+++ b/printing/emf_win.h
@@ -42,6 +42,9 @@ class PRINTING_EXPORT Emf : public Metafile {
Emf();
virtual ~Emf();
+ // Closes metafile.
+ void Close();
+
// Generates a new metafile that will record every GDI command, and will
// be saved to |metafile_path|.
virtual bool InitToFile(const base::FilePath& metafile_path);