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

Unified Diff: base/base_drop_target.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, 3 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 side-by-side diff with in-line comments
Download patch
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_;
}

Powered by Google App Engine
This is Rietveld 408576698