Commit 6254e556 authored by Xi Cheng's avatar Xi Cheng Committed by Commit Bot

Simplify namespace for ComPtr

Bug: 886957
Change-Id: I36adf26e497b0dee187ed151a09f16b966e277a8
Reviewed-on: https://chromium-review.googlesource.com/1240175Reviewed-by: default avatarFinnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Xi Cheng <chengx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593555}
parent b100ef19
...@@ -35,7 +35,7 @@ HRESULT MockIToastNotification::get_Content(winxml::Dom::IXmlDocument** value) { ...@@ -35,7 +35,7 @@ HRESULT MockIToastNotification::get_Content(winxml::Dom::IXmlDocument** value) {
return hr; return hr;
} }
Microsoft::WRL::ComPtr<winxml::Dom::IXmlDocument> xml_document; mswr::ComPtr<winxml::Dom::IXmlDocument> xml_document;
hr = xml_document_io.CopyTo(xml_document.GetAddressOf()); hr = xml_document_io.CopyTo(xml_document.GetAddressOf());
if (FAILED(hr)) { if (FAILED(hr)) {
LOG(ERROR) << "Unable to copy to XMLDoc " << hr; LOG(ERROR) << "Unable to copy to XMLDoc " << hr;
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include "chrome/notification_helper/notification_activator.h" #include "chrome/notification_helper/notification_activator.h"
#include "chrome/notification_helper/trace_util.h" #include "chrome/notification_helper/trace_util.h"
namespace mswr = Microsoft::WRL;
namespace { namespace {
// These values are persisted to logs. Entries should not be renumbered and // These values are persisted to logs. Entries should not be renumbered and
...@@ -64,9 +66,8 @@ HRESULT ComServerModule::Run() { ...@@ -64,9 +66,8 @@ HRESULT ComServerModule::Run() {
HRESULT ComServerModule::RegisterClassObjects() { HRESULT ComServerModule::RegisterClassObjects() {
// Create an out-of-proc COM module with caching disabled. The supplied // Create an out-of-proc COM module with caching disabled. The supplied
// method is invoked when the last instance object of the module is released. // method is invoked when the last instance object of the module is released.
auto& module = auto& module = mswr::Module<mswr::OutOfProcDisableCaching>::Create(
Microsoft::WRL::Module<Microsoft::WRL::OutOfProcDisableCaching>::Create( this, &ComServerModule::SignalObjectCountZero);
this, &ComServerModule::SignalObjectCountZero);
// Usually COM module classes statically define their CLSID at compile time // Usually COM module classes statically define their CLSID at compile time
// through the use of various macros, and WRL::Module internals takes care of // through the use of various macros, and WRL::Module internals takes care of
...@@ -74,11 +75,11 @@ HRESULT ComServerModule::RegisterClassObjects() { ...@@ -74,11 +75,11 @@ HRESULT ComServerModule::RegisterClassObjects() {
// register the same object with different CLSIDs depending on a runtime // register the same object with different CLSIDs depending on a runtime
// setting, so we handle that logic here. // setting, so we handle that logic here.
Microsoft::WRL::ComPtr<IUnknown> factory; mswr::ComPtr<IUnknown> factory;
unsigned int flags = Microsoft::WRL::ModuleType::OutOfProcDisableCaching; unsigned int flags = mswr::ModuleType::OutOfProcDisableCaching;
HRESULT hr = Microsoft::WRL::Details::CreateClassFactory< HRESULT hr = mswr::Details::CreateClassFactory<
Microsoft::WRL::SimpleClassFactory<NotificationActivator>>( mswr::SimpleClassFactory<NotificationActivator>>(
&flags, nullptr, __uuidof(IClassFactory), &factory); &flags, nullptr, __uuidof(IClassFactory), &factory);
if (FAILED(hr)) { if (FAILED(hr)) {
LogComServerModuleHistogram(ComServerModuleStatus::FACTORY_CREATION_FAILED); LogComServerModuleHistogram(ComServerModuleStatus::FACTORY_CREATION_FAILED);
...@@ -86,7 +87,7 @@ HRESULT ComServerModule::RegisterClassObjects() { ...@@ -86,7 +87,7 @@ HRESULT ComServerModule::RegisterClassObjects() {
return hr; return hr;
} }
Microsoft::WRL::ComPtr<IClassFactory> class_factory; mswr::ComPtr<IClassFactory> class_factory;
hr = factory.As(&class_factory); hr = factory.As(&class_factory);
if (FAILED(hr)) { if (FAILED(hr)) {
LogComServerModuleHistogram( LogComServerModuleHistogram(
...@@ -117,8 +118,7 @@ HRESULT ComServerModule::RegisterClassObjects() { ...@@ -117,8 +118,7 @@ HRESULT ComServerModule::RegisterClassObjects() {
} }
HRESULT ComServerModule::UnregisterClassObjects() { HRESULT ComServerModule::UnregisterClassObjects() {
auto& module = Microsoft::WRL::Module< auto& module = mswr::Module<mswr::OutOfProcDisableCaching>::GetModule();
Microsoft::WRL::OutOfProcDisableCaching>::GetModule();
HRESULT hr = HRESULT hr =
module.UnregisterCOMObject(nullptr, cookies_, arraysize(cookies_)); module.UnregisterCOMObject(nullptr, cookies_, arraysize(cookies_));
if (FAILED(hr)) { if (FAILED(hr)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment