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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_registrar_unittest.cc

Issue 1011683002: Lazily initialize MessageLoop for faster thread startup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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
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 "chrome/browser/sync/glue/sync_backend_registrar.h" 5 #include "chrome/browser/sync/glue/sync_backend_registrar.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "chrome/browser/sync/glue/ui_model_worker.h" 8 #include "chrome/browser/sync/glue/ui_model_worker.h"
9 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
10 #include "components/sync_driver/change_processor_mock.h" 10 #include "components/sync_driver/change_processor_mock.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 registrar->SetInitialTypes(ModelTypeSet()); 329 registrar->SetInitialTypes(ModelTypeSet());
330 330
331 // Start the shutdown. 331 // Start the shutdown.
332 registrar->RequestWorkerStopOnUIThread(); 332 registrar->RequestWorkerStopOnUIThread();
333 333
334 sync_thread->message_loop()->PostTask( 334 sync_thread->message_loop()->PostTask(
335 FROM_HERE, 335 FROM_HERE,
336 base::Bind(&SyncBackendRegistrar::Shutdown, 336 base::Bind(&SyncBackendRegistrar::Shutdown,
337 base::Unretained(registrar.release()))); 337 base::Unretained(registrar.release())));
338 338
339 // Make sure the thread starts running.
340 sync_thread->WaitUntilThreadStarted();
341
339 // The test verifies that the sync thread doesn't block because 342 // The test verifies that the sync thread doesn't block because
340 // of the blocked DB thread and can finish the shutdown. 343 // of the blocked DB thread and can finish the shutdown.
341 sync_thread->message_loop()->RunUntilIdle(); 344 sync_thread->message_loop()->RunUntilIdle();
342 345
343 db_thread_lock_.Release(); 346 db_thread_lock_.Release();
344 347
345 // Run the main thread loop until all workers have been removed and the 348 // Run the main thread loop until all workers have been removed and the
346 // registrar destroyed. 349 // registrar destroyed.
347 run_loop_.Run(); 350 run_loop_.Run();
348 } 351 }
349 352
350 } // namespace 353 } // namespace
351 354
352 } // namespace browser_sync 355 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/metrics/thread_watcher_unittest.cc ('k') | content/browser/browser_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698