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

Side by Side Diff: base/win/scoped_hdc.h

Issue 8139022: Rename ScopedHDC to ScopedCreateDC (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/aeropeek_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_WIN_SCOPED_HDC_H_ 5 #ifndef BASE_WIN_SCOPED_HDC_H_
6 #define BASE_WIN_SCOPED_HDC_H_ 6 #define BASE_WIN_SCOPED_HDC_H_
7 #pragma once 7 #pragma once
8 8
9 #include <windows.h> 9 #include <windows.h>
10 10
(...skipping 21 matching lines...) Expand all
32 32
33 operator HDC() { return hdc_; } 33 operator HDC() { return hdc_; }
34 34
35 private: 35 private:
36 HWND hwnd_; 36 HWND hwnd_;
37 HDC hdc_; 37 HDC hdc_;
38 DISALLOW_COPY_AND_ASSIGN(ScopedGetDC); 38 DISALLOW_COPY_AND_ASSIGN(ScopedGetDC);
39 }; 39 };
40 40
41 // Like ScopedHandle but for HDC. Only use this on HDCs returned from 41 // Like ScopedHandle but for HDC. Only use this on HDCs returned from
42 // CreateCompatibleDC. 42 // CreateCompatibleDC.
sanjeevr 2011/10/05 17:34:06 This comment should be CreateCompatibleDC, CreateD
yosin_UTC9 2011/10/06 03:35:35 Done.
43 // TODO(yosin) To eliminate confusion with ScopedGetDC, we should rename 43 class ScopedCreateDC {
44 // ScopedHDC to ScopedCreateDC.
45 class ScopedHDC {
46 public: 44 public:
47 ScopedHDC() : hdc_(NULL) { } 45 ScopedCreateDC() : hdc_(NULL) { }
48 explicit ScopedHDC(HDC h) : hdc_(h) { } 46 explicit ScopedCreateDC(HDC h) : hdc_(h) { }
49 47
50 ~ScopedHDC() { 48 ~ScopedCreateDC() {
51 Close(); 49 Close();
52 } 50 }
53 51
54 HDC Get() { 52 HDC Get() {
55 return hdc_; 53 return hdc_;
56 } 54 }
57 55
58 void Set(HDC h) { 56 void Set(HDC h) {
59 Close(); 57 Close();
60 hdc_ = h; 58 hdc_ = h;
61 } 59 }
62 60
63 operator HDC() { return hdc_; } 61 operator HDC() { return hdc_; }
64 62
65 private: 63 private:
66 void Close() { 64 void Close() {
67 #ifdef NOGDI 65 #ifdef NOGDI
68 assert(false); 66 assert(false);
69 #else 67 #else
70 if (hdc_) 68 if (hdc_)
71 DeleteDC(hdc_); 69 DeleteDC(hdc_);
72 #endif // NOGDI 70 #endif // NOGDI
73 } 71 }
74 72
75 HDC hdc_; 73 HDC hdc_;
76 DISALLOW_COPY_AND_ASSIGN(ScopedHDC); 74 DISALLOW_COPY_AND_ASSIGN(ScopedCreateDC);
77 }; 75 };
78 76
79 } // namespace win 77 } // namespace win
80 } // namespace base 78 } // namespace base
81 79
82 #endif // BASE_WIN_SCOPED_HDC_H_ 80 #endif // BASE_WIN_SCOPED_HDC_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/aeropeek_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698