summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 08:23:31 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 08:23:31 +0000
commitecb10fa1d0b06ba322e0782a1becb67730f69707 (patch)
treee1b944d00a329f9ef0837870a80d09bd01cfa310 /printing
parent4e5a81b5606ea6bd7be2f631e52e93d0d3b23902 (diff)
downloadchromium_src-ecb10fa1d0b06ba322e0782a1becb67730f69707.zip
chromium_src-ecb10fa1d0b06ba322e0782a1becb67730f69707.tar.gz
chromium_src-ecb10fa1d0b06ba322e0782a1becb67730f69707.tar.bz2
Revert of https://codereview.chromium.org/71013004/
Reason for revert: Causing compile failure in chrome_util.cc on "Google Chrome Win" http://build.chromium.org/p/chromium.chrome/builders/Google%20Chrome%20Win/builds/21803 TBR=cpu@chromium.org,jvoung@chromium.org,thakis@chromium.org,sergeyu@chromium.org,grt@chromium.org,gene@chromium.org,youngki@chromium.org,rvargas@chromium.org NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/90963002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237541 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/backend/win_helper.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/printing/backend/win_helper.h b/printing/backend/win_helper.h
index db66bf8..0f6b7ef 100644
--- a/printing/backend/win_helper.h
+++ b/printing/backend/win_helper.h
@@ -46,10 +46,9 @@ class ScopedPrinterHandle
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 @@ class ScopedPrinterHandle
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 {