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

Side by Side Diff: ppapi/proxy/tracked_callback_unittest.cc

Issue 1174543002: ppapi: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix V8VarConverterTest. Created 5 years, 6 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
« no previous file with comments | « ppapi/proxy/resource_reply_thread_registrar.cc ('k') | ppapi/shared_impl/ppapi_globals.h » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/location.h"
6 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/single_thread_task_runner.h"
9 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/simple_thread.h" 11 #include "base/threading/simple_thread.h"
11 #include "ppapi/c/pp_completion_callback.h" 12 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_errors.h" 13 #include "ppapi/c/pp_errors.h"
13 #include "ppapi/proxy/ppapi_proxy_test.h" 14 #include "ppapi/proxy/ppapi_proxy_test.h"
14 #include "ppapi/proxy/ppb_message_loop_proxy.h" 15 #include "ppapi/proxy/ppb_message_loop_proxy.h"
15 #include "ppapi/shared_impl/callback_tracker.h" 16 #include "ppapi/shared_impl/callback_tracker.h"
16 #include "ppapi/shared_impl/proxy_lock.h" 17 #include "ppapi/shared_impl/proxy_lock.h"
17 #include "ppapi/shared_impl/resource.h" 18 #include "ppapi/shared_impl/resource.h"
18 #include "ppapi/shared_impl/resource_tracker.h" 19 #include "ppapi/shared_impl/resource_tracker.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 ProxyAutoLock acquire; 239 ProxyAutoLock acquire;
239 reference_holder_ = 0; 240 reference_holder_ = 0;
240 } 241 }
241 242
242 // Create the test callbacks on a background thread, so that we can verify 243 // Create the test callbacks on a background thread, so that we can verify
243 // they are run on the same thread where they were created. 244 // they are run on the same thread where they were created.
244 void CreateCallbacksOnLoop(MessageLoopResource* loop_resource) { 245 void CreateCallbacksOnLoop(MessageLoopResource* loop_resource) {
245 ProxyAutoLock acquire; 246 ProxyAutoLock acquire;
246 // |thread_checker_| will bind to the background thread. 247 // |thread_checker_| will bind to the background thread.
247 thread_checker_.DetachFromThread(); 248 thread_checker_.DetachFromThread();
248 loop_resource->message_loop_proxy()->PostTask(FROM_HERE, 249 loop_resource->task_runner()->PostTask(
249 RunWhileLocked( 250 FROM_HERE, RunWhileLocked(base::Bind(
250 base::Bind(&CallbackMockResource::CreateCallbacks, this))); 251 &CallbackMockResource::CreateCallbacks, this)));
251 } 252 }
252 253
253 int32_t CompletionTask(CallbackRunInfo* info, int32_t result) { 254 int32_t CompletionTask(CallbackRunInfo* info, int32_t result) {
254 // The completion task must run on the thread where the callback was 255 // The completion task must run on the thread where the callback was
255 // created, and must hold the proxy lock. 256 // created, and must hold the proxy lock.
256 CHECK(thread_checker_.CalledOnValidThread()); 257 CHECK(thread_checker_.CalledOnValidThread());
257 ProxyLock::AssertAcquired(); 258 ProxyLock::AssertAcquired();
258 259
259 // We should run before the callback. 260 // We should run before the callback.
260 CHECK_EQ(0U, info->run_count()); 261 CHECK_EQ(0U, info->run_count());
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 resource->ReleaseRef(); 463 resource->ReleaseRef();
463 resource->CheckFinalState(); 464 resource->CheckFinalState();
464 { 465 {
465 ProxyAutoLock lock; 466 ProxyAutoLock lock;
466 resource = nullptr; 467 resource = nullptr;
467 } 468 }
468 } 469 }
469 470
470 } // namespace proxy 471 } // namespace proxy
471 } // namespace ppapi 472 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/resource_reply_thread_registrar.cc ('k') | ppapi/shared_impl/ppapi_globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698