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

Unified Diff: printing/backend/win_helper.h

Issue 90963002: Revert of Base: Remove Receive() from ScopedHandle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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
diff --git a/printing/backend/win_helper.h b/printing/backend/win_helper.h
index db66bf89c4822c94aab94a7c41dd4501d7f0e4ab..0f6b7ef80855ad31b501a81ba90f49f7ddb8e0b0 100644
--- a/printing/backend/win_helper.h
+++ b/printing/backend/win_helper.h
@@ -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