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

Unified Diff: chrome/service/service_utility_process_host.cc

Issue 6695013: Cleanup NativeMetafile (win) interface and EMF class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 9 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
« no previous file with comments | « chrome/service/service_utility_process_host.h ('k') | chrome/utility/utility_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/service_utility_process_host.cc
diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc
index 31f8b0efda77802f7bfe49b8fc8598fefc2e6e9b..0e8aa386cab0277648e9ddbf360391c91ac637a0 100644
--- a/chrome/service/service_utility_process_host.cc
+++ b/chrome/service/service_utility_process_host.cc
@@ -19,8 +19,7 @@
#if defined(OS_WIN)
#include "base/scoped_ptr.h"
#include "base/win/scoped_handle.h"
-#include "printing/native_metafile_factory.h"
-#include "printing/native_metafile.h"
+#include "printing/emf_win.h"
#endif
ServiceUtilityProcessHost::ServiceUtilityProcessHost(
@@ -203,15 +202,15 @@ void ServiceUtilityProcessHost::Client::MetafileAvailable(
if (!scratch_metafile_dir.Set(metafile_path.DirName()))
LOG(WARNING) << "Unable to set scratch metafile directory";
#if defined(OS_WIN)
- scoped_ptr<printing::NativeMetafile> metafile(
- printing::NativeMetafileFactory::Create());
- if (!metafile->CreateFromFile(metafile_path)) {
+ // It's important that metafile is declared after scratch_metafile_dir so
+ // that the metafile destructor closes the file before the ScopedTempDir
+ // destructor tries to remove the directory.
+ printing::Emf metafile;
+ if (!metafile.InitFromFile(metafile_path)) {
OnRenderPDFPagesToMetafileFailed();
} else {
- OnRenderPDFPagesToMetafileSucceeded(*metafile,
+ OnRenderPDFPagesToMetafileSucceeded(metafile,
highest_rendered_page_number);
- // Close it so that ScopedTempDir can delete the folder.
- metafile->CloseEmf();
}
#endif // defined(OS_WIN)
}
« no previous file with comments | « chrome/service/service_utility_process_host.h ('k') | chrome/utility/utility_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698