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

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

Issue 1467003002: Switch to static_assert in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: / Created 5 years 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
« no previous file with comments | « base/win/scoped_bstr.cc ('k') | base/win/scoped_variant.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_COMPTR_H_ 5 #ifndef BASE_WIN_SCOPED_COMPTR_H_
6 #define BASE_WIN_SCOPED_COMPTR_H_ 6 #define BASE_WIN_SCOPED_COMPTR_H_
7 7
8 #include <unknwn.h> 8 #include <unknwn.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 25 matching lines...) Expand all
36 explicit ScopedComPtr(Interface* p) : ParentClass(p) { 36 explicit ScopedComPtr(Interface* p) : ParentClass(p) {
37 } 37 }
38 38
39 ScopedComPtr(const ScopedComPtr<Interface, interface_id>& p) 39 ScopedComPtr(const ScopedComPtr<Interface, interface_id>& p)
40 : ParentClass(p) { 40 : ParentClass(p) {
41 } 41 }
42 42
43 ~ScopedComPtr() { 43 ~ScopedComPtr() {
44 // We don't want the smart pointer class to be bigger than the pointer 44 // We don't want the smart pointer class to be bigger than the pointer
45 // it wraps. 45 // it wraps.
46 COMPILE_ASSERT(sizeof(ScopedComPtr<Interface, interface_id>) == 46 static_assert(
47 sizeof(Interface*), ScopedComPtrSize); 47 sizeof(ScopedComPtr<Interface, interface_id>) == sizeof(Interface*),
48 "ScopedComPtrSize");
48 } 49 }
49 50
50 // Explicit Release() of the held object. Useful for reuse of the 51 // Explicit Release() of the held object. Useful for reuse of the
51 // ScopedComPtr instance. 52 // ScopedComPtr instance.
52 // Note that this function equates to IUnknown::Release and should not 53 // Note that this function equates to IUnknown::Release and should not
53 // be confused with e.g. scoped_ptr::release(). 54 // be confused with e.g. scoped_ptr::release().
54 void Release() { 55 void Release() {
55 if (this->ptr_ != NULL) { 56 if (this->ptr_ != NULL) {
56 this->ptr_->Release(); 57 this->ptr_->Release();
57 this->ptr_ = NULL; 58 this->ptr_ = NULL;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 159
159 static const IID& iid() { 160 static const IID& iid() {
160 return *interface_id; 161 return *interface_id;
161 } 162 }
162 }; 163 };
163 164
164 } // namespace win 165 } // namespace win
165 } // namespace base 166 } // namespace base
166 167
167 #endif // BASE_WIN_SCOPED_COMPTR_H_ 168 #endif // BASE_WIN_SCOPED_COMPTR_H_
OLDNEW
« no previous file with comments | « base/win/scoped_bstr.cc ('k') | base/win/scoped_variant.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698