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

Side by Side Diff: base/base_drag_source.cc

Issue 5009: Fix some issues found looking at the code.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include <atlbase.h>
6
7 #include "base/base_drag_source.h" 5 #include "base/base_drag_source.h"
8 6
9 /////////////////////////////////////////////////////////////////////////////// 7 ///////////////////////////////////////////////////////////////////////////////
10 // BaseDragSource, public: 8 // BaseDragSource, public:
11 9
12 BaseDragSource::BaseDragSource() : ref_count_(0) { 10 BaseDragSource::BaseDragSource() : ref_count_(0) {
13 } 11 }
14 12
15 /////////////////////////////////////////////////////////////////////////////// 13 ///////////////////////////////////////////////////////////////////////////////
16 // BaseDragSource, IDropSource implementation: 14 // BaseDragSource, IDropSource implementation:
(...skipping 26 matching lines...) Expand all
43 if (IsEqualIID(iid, IID_IUnknown) || IsEqualIID(iid, IID_IDropSource)) { 41 if (IsEqualIID(iid, IID_IUnknown) || IsEqualIID(iid, IID_IDropSource)) {
44 *object = this; 42 *object = this;
45 } else { 43 } else {
46 return E_NOINTERFACE; 44 return E_NOINTERFACE;
47 } 45 }
48 AddRef(); 46 AddRef();
49 return S_OK; 47 return S_OK;
50 } 48 }
51 49
52 ULONG BaseDragSource::AddRef() { 50 ULONG BaseDragSource::AddRef() {
53 return InterlockedIncrement(&ref_count_); 51 return ++ref_count_;
54 } 52 }
55 53
56 ULONG BaseDragSource::Release() { 54 ULONG BaseDragSource::Release() {
57 if (InterlockedDecrement(&ref_count_) == 0) { 55 if (--ref_count_ == 0) {
58 ULONG copied_refcnt = ref_count_;
59 delete this; 56 delete this;
60 return copied_refcnt; 57 return 0U;
61 } 58 }
62 return ref_count_; 59 return ref_count_;
63 } 60 }
64
OLDNEW
« no previous file with comments | « base/base_drag_source.h ('k') | base/base_drop_target.h » ('j') | base/base_drop_target.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698