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

Unified Diff: base/win/scoped_com_initializer.h

Issue 10990079: Clean up scoped_com_initializer.h. Remove #ifdefs for non-Windows (this is in base/win, no one sho… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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/win/scoped_com_initializer.h
===================================================================
--- base/win/scoped_com_initializer.h (revision 158860)
+++ base/win/scoped_com_initializer.h (working copy)
@@ -5,14 +5,12 @@
#ifndef BASE_WIN_SCOPED_COM_INITIALIZER_H_
#define BASE_WIN_SCOPED_COM_INITIALIZER_H_
+#include <objbase.h>
+
#include "base/basictypes.h"
#include "base/logging.h"
#include "build/build_config.h"
-#if defined(OS_WIN)
-
-#include <objbase.h>
-
namespace base {
namespace win {
@@ -38,7 +36,7 @@
// Using the windows API directly to avoid dependency on platform_thread.
DCHECK_EQ(GetCurrentThreadId(), thread_id_);
#endif
- if (SUCCEEDED(hr_))
+ if (succeeded())
CoUninitialize();
}
@@ -51,17 +49,10 @@
#endif
hr_ = CoInitializeEx(NULL, init);
#ifndef NDEBUG
- switch (hr_) {
- case S_FALSE:
- LOG(ERROR) << "Multiple CoInitialize() called for thread "
- << thread_id_;
- break;
- case RPC_E_CHANGED_MODE:
- DCHECK(false) << "Invalid COM thread model change";
- break;
- default:
- break;
- }
+ if (hr_ == S_FALSE)
+ LOG(ERROR) << "Multiple CoInitialize() calls for thread " << thread_id_;
+ else
+ DCHECK_NE(RPC_E_CHANGED_MODE, hr_) << "Invalid COM thread model change";
#endif
}
@@ -80,28 +71,4 @@
} // namespace win
} // namespace base
-#else
-
-namespace base {
-namespace win {
-
-// Do-nothing class for other platforms.
-class ScopedCOMInitializer {
- public:
- enum SelectMTA { kMTA };
- ScopedCOMInitializer() {}
- explicit ScopedCOMInitializer(SelectMTA mta) {}
- ~ScopedCOMInitializer() {}
-
- bool succeeded() const { return true; }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ScopedCOMInitializer);
-};
-
-} // namespace win
-} // namespace base
-
-#endif
-
#endif // BASE_WIN_SCOPED_COM_INITIALIZER_H_

Powered by Google App Engine
This is Rietveld 408576698