Chromium Code Reviews| Index: base/base_drop_target.cc |
| =================================================================== |
| --- base/base_drop_target.cc (revision 2670) |
| +++ base/base_drop_target.cc (working copy) |
| @@ -2,11 +2,10 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include <windows.h> |
| +#include "base/base_drop_target.h" |
| + |
| #include <shlobj.h> |
| -#include "base/base_drop_target.h" |
| - |
| #include "base/logging.h" |
| /////////////////////////////////////////////////////////////////////////////// |
| @@ -14,14 +13,16 @@ |
| IDropTargetHelper* BaseDropTarget::cached_drop_target_helper_ = NULL; |
| BaseDropTarget::BaseDropTarget(HWND hwnd) |
| - : suspend_(false), |
| - ref_count_(0), |
| - hwnd_(hwnd) { |
| + : hwnd_(hwnd), |
| + suspend_(false), |
| + ref_count_(0) { |
| DCHECK(hwnd); |
| HRESULT result = RegisterDragDrop(hwnd, this); |
| + DCHECK(SUCCEEDED(result)); |
| } |
| BaseDropTarget::~BaseDropTarget() { |
|
Dean McNamee
2008/09/30 20:47:26
Maybe just put this on one line
cpu_(ooo_6.6-7.5)
2008/09/30 23:35:05
I rather have a way to put a breakpoint in the dto
|
| + |
| } |
| // static |
| @@ -125,14 +126,13 @@ |
| } |
| ULONG BaseDropTarget::AddRef() { |
| - return InterlockedIncrement(&ref_count_); |
| + return ++ref_count_; |
| } |
| ULONG BaseDropTarget::Release() { |
| - if (InterlockedDecrement(&ref_count_) == 0) { |
| - ULONG copied_refcnt = ref_count_; |
| + if (--ref_count_ == 0) { |
| delete this; |
| - return copied_refcnt; |
| + return 0U; |
| } |
| return ref_count_; |
| } |