summaryrefslogtreecommitdiffstats
path: root/win8
diff options
context:
space:
mode:
authordcheng <dcheng@chromium.org>2014-11-21 13:08:45 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-21 21:09:28 +0000
commitaad41eecdd47c0ec9504be1e5bf5ec0b07b167f7 (patch)
tree4b22ab4eb385bc5ccb332f0ae029e2cacb9b42f9 /win8
parent5546373f24680054ad4e1eca425b5b1b7291dfe9 (diff)
downloadchromium_src-aad41eecdd47c0ec9504be1e5bf5ec0b07b167f7.zip
chromium_src-aad41eecdd47c0ec9504be1e5bf5ec0b07b167f7.tar.gz
chromium_src-aad41eecdd47c0ec9504be1e5bf5ec0b07b167f7.tar.bz2
Remove implicit conversions from scoped_refptr to T* in win8/
This patch was generated by running the rewrite_scoped_refptr clang tool on a Windows build. BUG=110610 Review URL: https://codereview.chromium.org/740653005 Cr-Commit-Position: refs/heads/master@{#305279}
Diffstat (limited to 'win8')
-rw-r--r--win8/delegate_execute/delegate_execute.cc5
-rw-r--r--win8/metro_driver/ime/input_source.cc9
-rw-r--r--win8/metro_driver/ime/text_service.cc30
-rw-r--r--win8/metro_driver/ime/text_store.cc28
-rw-r--r--win8/test/ui_automation_client.cc24
-rw-r--r--win8/viewer/metro_viewer_process_host.cc6
6 files changed, 46 insertions, 56 deletions
diff --git a/win8/delegate_execute/delegate_execute.cc b/win8/delegate_execute/delegate_execute.cc
index 575ed9e..118bfe2 100644
--- a/win8/delegate_execute/delegate_execute.cc
+++ b/win8/delegate_execute/delegate_execute.cc
@@ -62,8 +62,9 @@ class DelegateExecuteModule
instance_.ReceiveVoid());
if (FAILED(hr))
return hr;
- hr = ::CoRegisterClassObject(clsid, instance_, CLSCTX_LOCAL_SERVER,
- REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED, &registration_token_);
+ hr = ::CoRegisterClassObject(clsid, instance_.get(), CLSCTX_LOCAL_SERVER,
+ REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED,
+ &registration_token_);
if (FAILED(hr))
return hr;
diff --git a/win8/metro_driver/ime/input_source.cc b/win8/metro_driver/ime/input_source.cc
index 9f549d7..6a63751 100644
--- a/win8/metro_driver/ime/input_source.cc
+++ b/win8/metro_driver/ime/input_source.cc
@@ -53,7 +53,7 @@ class ATL_NO_VTABLE InputSourceMonitor
}
void Unadvise() {
- if (cookie_ == TF_INVALID_COOKIE || !source_)
+ if (cookie_ == TF_INVALID_COOKIE || !source_.get())
return;
if (FAILED(source_->UnadviseSink(cookie_)))
return;
@@ -145,7 +145,7 @@ scoped_ptr<InputSource> InputSource::Create() {
return scoped_ptr<InputSource>();
}
base::win::ScopedComPtr<ITfSource> profiles_source;
- hr = profiles_source.QueryFrom(profile_manager);
+ hr = profiles_source.QueryFrom(profile_manager.get());
if (FAILED(hr)) {
LOG(ERROR) << "QueryFrom to ITfSource failed. hr = " << hr;
return scoped_ptr<InputSource>();
@@ -158,13 +158,14 @@ scoped_ptr<InputSource> InputSource::Create() {
<< " hr = " << hr;
return scoped_ptr<InputSource>();
}
- if (!monitor->Initialize(profiles_source)) {
+ if (!monitor->Initialize(profiles_source.get())) {
LOG(ERROR) << "Failed to initialize the monitor.";
return scoped_ptr<InputSource>();
}
// Transfer the ownership.
- return scoped_ptr<InputSource>(new InputSourceImpl(profile_manager, monitor));
+ return scoped_ptr<InputSource>(
+ new InputSourceImpl(profile_manager.get(), monitor));
}
} // namespace metro_driver
diff --git a/win8/metro_driver/ime/text_service.cc b/win8/metro_driver/ime/text_service.cc
index 1135619..6eec40f 100644
--- a/win8/metro_driver/ime/text_service.cc
+++ b/win8/metro_driver/ime/text_service.cc
@@ -176,7 +176,7 @@ class EventSink {
: cookie_(cookie),
source_(source) {}
~EventSink() {
- if (!source_ || cookie_ != TF_INVALID_COOKIE)
+ if (!source_.get() || cookie_ != TF_INVALID_COOKIE)
return;
source_->UnadviseSink(cookie_);
cookie_ = TF_INVALID_COOKIE;
@@ -218,7 +218,7 @@ scoped_ptr<EventSink> CreateTextEditSink(ITfContext* context,
class DocumentBinding {
public:
~DocumentBinding() {
- if (!document_manager_)
+ if (!document_manager_.get())
return;
document_manager_->Pop(TF_POPF_ALL);
}
@@ -244,7 +244,7 @@ class DocumentBinding {
scoped_refptr<TextStore> text_store;
if (!use_null_text_store) {
text_store = TextStore::Create(window_handle, input_scopes, delegate);
- if (!text_store) {
+ if (!text_store.get()) {
LOG(ERROR) << "Failed to create TextStore.";
return scoped_ptr<DocumentBinding>();
}
@@ -266,20 +266,20 @@ class DocumentBinding {
// If null-TextStore is used or |input_scopes| looks like a password field,
// set special properties to tell IMEs to be disabled.
if ((use_null_text_store || IsPasswordField(input_scopes)) &&
- !InitializeDisabledContext(context, client_id)) {
+ !InitializeDisabledContext(context.get(), client_id)) {
LOG(ERROR) << "InitializeDisabledContext failed.";
return scoped_ptr<DocumentBinding>();
}
scoped_ptr<EventSink> text_edit_sink;
if (!use_null_text_store) {
- text_edit_sink = CreateTextEditSink(context, text_store);
+ text_edit_sink = CreateTextEditSink(context.get(), text_store.get());
if (!text_edit_sink) {
LOG(ERROR) << "CreateTextEditSink failed.";
return scoped_ptr<DocumentBinding>();
}
}
- hr = document_manager->Push(context);
+ hr = document_manager->Push(context.get());
if (FAILED(hr)) {
LOG(ERROR) << "ITfDocumentMgr::Push failed. hr = " << hr;
return scoped_ptr<DocumentBinding>();
@@ -290,9 +290,7 @@ class DocumentBinding {
text_edit_sink.Pass()));
}
- ITfDocumentMgr* document_manager() const {
- return document_manager_;
- }
+ ITfDocumentMgr* document_manager() const { return document_manager_.get(); }
scoped_refptr<TextStore> text_store() const {
return text_store_;
@@ -326,7 +324,7 @@ class TextServiceImpl : public TextService,
thread_manager_(thread_manager) {
DCHECK_NE(TF_CLIENTID_NULL, client_id);
DCHECK(window_handle != NULL);
- DCHECK(thread_manager_);
+ DCHECK(thread_manager_.get());
}
virtual ~TextServiceImpl() {
thread_manager_->Deactivate();
@@ -339,8 +337,8 @@ class TextServiceImpl : public TextService,
VLOG(0) << "|current_document_| is NULL due to the previous error.";
return;
}
- TextStore* text_store = current_document_->text_store();
- if (!text_store)
+ scoped_refptr<TextStore> text_store = current_document_->text_store();
+ if (!text_store.get())
return;
text_store->CancelComposition();
}
@@ -479,15 +477,13 @@ CreateTextService(TextServiceDelegate* delegate, HWND window_handle) {
LOG(ERROR) << "ITfThreadMgr::Activate failed. hr = " << hr;
return scoped_ptr<TextService>();
}
- if (!InitializeSentenceMode(thread_manager, client_id)) {
+ if (!InitializeSentenceMode(thread_manager.get(), client_id)) {
LOG(ERROR) << "InitializeSentenceMode failed.";
thread_manager->Deactivate();
return scoped_ptr<TextService>();
}
- return scoped_ptr<TextService>(new TextServiceImpl(thread_manager,
- client_id,
- window_handle,
- delegate));
+ return scoped_ptr<TextService>(new TextServiceImpl(
+ thread_manager.get(), client_id, window_handle, delegate));
}
} // namespace metro_driver
diff --git a/win8/metro_driver/ime/text_store.cc b/win8/metro_driver/ime/text_store.cc
index 0c0389b..eff30b7 100644
--- a/win8/metro_driver/ime/text_store.cc
+++ b/win8/metro_driver/ime/text_store.cc
@@ -59,7 +59,7 @@ scoped_refptr<TextStore> TextStore::Create(
}
base::win::ScopedComPtr<ITfInputScope> input_scope =
CreteInputScope(input_scopes);
- if (!input_scope) {
+ if (!input_scope.get()) {
LOG(ERROR) << "Failed to initialize InputScope.";
return scoped_refptr<TextStore>();
}
@@ -72,10 +72,8 @@ scoped_refptr<TextStore> TextStore::Create(
<< hr;
return scoped_refptr<TextStore>();
}
- object->Initialize(window_handle,
- category_manager,
- display_attribute_manager,
- input_scope,
+ object->Initialize(window_handle, category_manager.get(),
+ display_attribute_manager.get(), input_scope.get(),
delegate);
return scoped_refptr<TextStore>(object);
}
@@ -98,7 +96,7 @@ STDMETHODIMP TextStore::AdviseSink(REFIID iid,
DWORD mask) {
if (!IsEqualGUID(iid, IID_ITextStoreACPSink))
return E_INVALIDARG;
- if (text_store_acp_sink_) {
+ if (text_store_acp_sink_.get()) {
if (text_store_acp_sink_.IsSameObject(unknown)) {
text_store_acp_sink_mask_ = mask;
return S_OK;
@@ -581,7 +579,7 @@ STDMETHODIMP TextStore::RequestSupportedAttrs(
const TS_ATTRID* attribute_buffer) {
if (!attribute_buffer)
return E_INVALIDARG;
- if (!input_scope_)
+ if (!input_scope_.get())
return E_FAIL;
// We support only input scope attribute.
for (size_t i = 0; i < attribute_buffer_size; ++i) {
@@ -600,7 +598,7 @@ STDMETHODIMP TextStore::RetrieveRequestedAttrs(
*attribute_buffer_copied = 0;
if (!attribute_buffer)
return E_INVALIDARG;
- if (!input_scope_)
+ if (!input_scope_.get())
return E_UNEXPECTED;
// We support only input scope attribute.
*attribute_buffer_copied = 0;
@@ -751,14 +749,14 @@ bool TextStore::GetCompositionStatus(
}
if (FAILED(context->GetEnd(read_only_edit_cookie, end_range.Receive())))
return false;
- if (FAILED(start_to_end_range->ShiftEndToRange(read_only_edit_cookie,
- end_range, TF_ANCHOR_END))) {
+ if (FAILED(start_to_end_range->ShiftEndToRange(
+ read_only_edit_cookie, end_range.get(), TF_ANCHOR_END))) {
return false;
}
base::win::ScopedComPtr<IEnumTfRanges> ranges;
if (FAILED(track_property->EnumRanges(read_only_edit_cookie, ranges.Receive(),
- start_to_end_range))) {
+ start_to_end_range.get()))) {
return false;
}
@@ -768,7 +766,7 @@ bool TextStore::GetCompositionStatus(
return true;
base::win::ScopedVariant value;
base::win::ScopedComPtr<IEnumTfPropertyValue> enum_prop_value;
- if (FAILED(track_property->GetValue(read_only_edit_cookie, range,
+ if (FAILED(track_property->GetValue(read_only_edit_cookie, range.get(),
value.Receive()))) {
return false;
}
@@ -792,7 +790,7 @@ bool TextStore::GetCompositionStatus(
}
base::win::ScopedComPtr<ITfRangeACP> range_acp;
- range_acp.QueryFrom(range);
+ range_acp.QueryFrom(range.get());
LONG start_pos, length;
range_acp->GetExtent(&start_pos, &length);
if (is_composition) {
@@ -879,8 +877,10 @@ bool TextStore::ConfirmComposition() {
}
void TextStore::SendOnLayoutChange() {
- if (text_store_acp_sink_ && (text_store_acp_sink_mask_ & TS_AS_LAYOUT_CHANGE))
+ if (text_store_acp_sink_.get() &&
+ (text_store_acp_sink_mask_ & TS_AS_LAYOUT_CHANGE)) {
text_store_acp_sink_->OnLayoutChange(TS_LC_CHANGE, 0);
+ }
}
bool TextStore::HasReadLock() const {
diff --git a/win8/test/ui_automation_client.cc b/win8/test/ui_automation_client.cc
index bb5082e..6f2793c 100644
--- a/win8/test/ui_automation_client.cc
+++ b/win8/test/ui_automation_client.cc
@@ -249,11 +249,8 @@ HRESULT UIAutomationClient::Context::InstallWindowObserver() {
event_handler_obj);
result = automation_->AddAutomationEventHandler(
- UIA_Window_WindowOpenedEventId,
- root_element,
- TreeScope_Descendants,
- cache_request,
- event_handler);
+ UIA_Window_WindowOpenedEventId, root_element.get(), TreeScope_Descendants,
+ cache_request.get(), event_handler.get());
if (FAILED(result)) {
LOG(ERROR) << std::hex << result;
@@ -281,9 +278,7 @@ HRESULT UIAutomationClient::Context::RemoveWindowObserver() {
}
result = automation_->RemoveAutomationEventHandler(
- UIA_Window_WindowOpenedEventId,
- root_element,
- event_handler_);
+ UIA_Window_WindowOpenedEventId, root_element.get(), event_handler_.get());
if (FAILED(result)) {
LOG(ERROR) << std::hex << result;
return result;
@@ -423,9 +418,7 @@ HRESULT UIAutomationClient::Context::InvokeDesiredItem(
result = element->FindFirstBuildCache(
static_cast<TreeScope>(TreeScope_Children | TreeScope_Descendants),
- condition,
- cache_request,
- target.Receive());
+ condition.get(), cache_request.get(), target.Receive());
if (FAILED(result)) {
LOG(ERROR) << std::hex << result;
return result;
@@ -489,8 +482,9 @@ HRESULT UIAutomationClient::Context::GetInvokableItems(
return result;
}
- result = automation_->CreateAndCondition(
- invokable_condition, control_view_condition, condition.Receive());
+ result = automation_->CreateAndCondition(invokable_condition.get(),
+ control_view_condition.get(),
+ condition.Receive());
if (FAILED(result)) {
LOG(ERROR) << std::hex << result;
return result;
@@ -506,9 +500,7 @@ HRESULT UIAutomationClient::Context::GetInvokableItems(
result = element->FindAllBuildCache(
static_cast<TreeScope>(TreeScope_Children | TreeScope_Descendants),
- condition,
- cache_request,
- element_array.Receive());
+ condition.get(), cache_request.get(), element_array.Receive());
if (FAILED(result)) {
LOG(ERROR) << std::hex << result;
return result;
diff --git a/win8/viewer/metro_viewer_process_host.cc b/win8/viewer/metro_viewer_process_host.cc
index 276aa2c..9f35ec3 100644
--- a/win8/viewer/metro_viewer_process_host.cc
+++ b/win8/viewer/metro_viewer_process_host.cc
@@ -65,7 +65,7 @@ MetroViewerProcessHost::~MetroViewerProcessHost() {
base::ProcessId viewer_process_id = GetViewerProcessId();
channel_->Close();
- if (message_filter_) {
+ if (message_filter_.get()) {
// Wait for the viewer process to go away.
if (viewer_process_id != base::kNullProcessId) {
base::ProcessHandle viewer_process = NULL;
@@ -78,7 +78,7 @@ MetroViewerProcessHost::~MetroViewerProcessHost() {
::CloseHandle(viewer_process);
}
}
- channel_->RemoveFilter(message_filter_);
+ channel_->RemoveFilter(message_filter_.get());
}
instance_ = NULL;
}
@@ -96,7 +96,7 @@ bool MetroViewerProcessHost::LaunchViewerAndWaitForConnection(
channel_connected_event_.reset(new base::WaitableEvent(false, false));
message_filter_ = new InternalMessageFilter(this);
- channel_->AddFilter(message_filter_);
+ channel_->AddFilter(message_filter_.get());
if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
base::win::ScopedComPtr<IApplicationActivationManager> activator;