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

Unified Diff: printing/backend/win_helper.h

Issue 92173002: Merge 237541 "Revert of https://codereview.chromium.org/71013004/" (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1721/src/
Patch Set: Created 7 years, 1 month 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 | « net/base/net_util_win.cc ('k') | remoting/host/desktop_session_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/backend/win_helper.h
===================================================================
--- printing/backend/win_helper.h (revision 237598)
+++ printing/backend/win_helper.h (working copy)
@@ -46,10 +46,9 @@
base::win::VerifierTraits> {
public:
bool OpenPrinter(const wchar_t* printer) {
- HANDLE temp_handle;
// ::OpenPrinter may return error but assign some value into handle.
- if (::OpenPrinter(const_cast<LPTSTR>(printer), &temp_handle, NULL)) {
- Set(temp_handle);
+ if (!::OpenPrinter(const_cast<LPTSTR>(printer), Receive(), NULL)) {
+ Take();
}
return IsValid();
}
@@ -57,6 +56,10 @@
private:
typedef base::win::GenericScopedHandle<PrinterHandleTraits,
base::win::VerifierTraits> Base;
+ // Hide Receive to avoid assigning handle when ::OpenPrinter returned error.
+ Base::Receiver Receive() {
+ return Base::Receive();
+ }
};
class PrinterChangeHandleTraits {
« no previous file with comments | « net/base/net_util_win.cc ('k') | remoting/host/desktop_session_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698