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

Side by Side Diff: win8/test/ui_automation_client.cc

Issue 14299011: Remove all but one use of WeakPtrFactory::DetachFromThread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove checks for death with correct error, which seem to fail on iOS Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "win8/test/ui_automation_client.h" 5 #include "win8/test/ui_automation_client.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlcom.h> 8 #include <atlcom.h>
9 #include <oleauto.h> 9 #include <oleauto.h>
10 #include <uiautomation.h> 10 #include <uiautomation.h>
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 base::Bind(&UIAutomationClient::Context::HandleAutomationEvent, context_, 151 base::Bind(&UIAutomationClient::Context::HandleAutomationEvent, context_,
152 base::win::ScopedComPtr<IUIAutomationElement>(sender), 152 base::win::ScopedComPtr<IUIAutomationElement>(sender),
153 eventId)); 153 eventId));
154 154
155 return S_OK; 155 return S_OK;
156 } 156 }
157 157
158 base::WeakPtr<UIAutomationClient::Context> 158 base::WeakPtr<UIAutomationClient::Context>
159 UIAutomationClient::Context::Create() { 159 UIAutomationClient::Context::Create() {
160 Context* context = new Context(); 160 Context* context = new Context();
161 base::WeakPtr<Context> context_ptr(context->weak_ptr_factory_.GetWeakPtr()); 161 return context->weak_ptr_factory_.GetWeakPtr();
162 // Unbind from this thread so that the instance will bind to the automation
163 // thread when Initialize is called.
164 context->weak_ptr_factory_.DetachFromThread();
165 return context_ptr;
166 } 162 }
167 163
168 void UIAutomationClient::Context::DeleteOnAutomationThread() { 164 void UIAutomationClient::Context::DeleteOnAutomationThread() {
169 DCHECK(thread_checker_.CalledOnValidThread()); 165 DCHECK(thread_checker_.CalledOnValidThread());
170 delete this; 166 delete this;
171 } 167 }
172 168
173 UIAutomationClient::Context::Context() : weak_ptr_factory_(this) {} 169 UIAutomationClient::Context::Context() : weak_ptr_factory_(this) {}
174 170
175 UIAutomationClient::Context::~Context() { 171 UIAutomationClient::Context::~Context() {
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 context_, 618 context_,
623 base::ThreadTaskRunnerHandle::Get(), 619 base::ThreadTaskRunnerHandle::Get(),
624 string16(class_name), 620 string16(class_name),
625 item_name, 621 item_name,
626 init_callback, 622 init_callback,
627 result_callback)); 623 result_callback));
628 } 624 }
629 625
630 } // namespace internal 626 } // namespace internal
631 } // namespace win8 627 } // namespace win8
OLDNEW
« no previous file with comments | « webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698