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

Side by Side Diff: chrome/browser/sync/profile_sync_service_harness.cc

Issue 9384024: Prefer ScopedNestableTaskAllower over manual save/restore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename back to "allow". Created 8 years, 10 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
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/profile_sync_service_harness.h" 5 #include "chrome/browser/sync/profile_sync_service_harness.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <iterator> 8 #include <iterator>
9 #include <ostream> 9 #include <ostream>
10 #include <set> 10 #include <set>
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 bool ProfileSyncServiceHarness::AwaitStatusChangeWithTimeout( 739 bool ProfileSyncServiceHarness::AwaitStatusChangeWithTimeout(
740 int timeout_milliseconds, 740 int timeout_milliseconds,
741 const std::string& reason) { 741 const std::string& reason) {
742 DVLOG(1) << GetClientInfoString("AwaitStatusChangeWithTimeout"); 742 DVLOG(1) << GetClientInfoString("AwaitStatusChangeWithTimeout");
743 if (wait_state_ == SYNC_DISABLED) { 743 if (wait_state_ == SYNC_DISABLED) {
744 LOG(ERROR) << "Sync disabled for " << profile_debug_name_ << "."; 744 LOG(ERROR) << "Sync disabled for " << profile_debug_name_ << ".";
745 return false; 745 return false;
746 } 746 }
747 scoped_refptr<StateChangeTimeoutEvent> timeout_signal( 747 scoped_refptr<StateChangeTimeoutEvent> timeout_signal(
748 new StateChangeTimeoutEvent(this, reason)); 748 new StateChangeTimeoutEvent(this, reason));
749 MessageLoop* loop = MessageLoop::current(); 749 {
750 bool did_allow_nestable_tasks = loop->NestableTasksAllowed(); 750 MessageLoop* loop = MessageLoop::current();
751 loop->SetNestableTasksAllowed(true); 751 MessageLoop::ScopedNestableTaskAllower allow(loop);
752 loop->PostDelayedTask( 752 loop->PostDelayedTask(
753 FROM_HERE, 753 FROM_HERE,
754 base::Bind(&StateChangeTimeoutEvent::Callback, 754 base::Bind(&StateChangeTimeoutEvent::Callback,
755 timeout_signal.get()), 755 timeout_signal.get()),
756 base::TimeDelta::FromMilliseconds(timeout_milliseconds)); 756 base::TimeDelta::FromMilliseconds(timeout_milliseconds));
757 loop->Run(); 757 loop->Run();
758 loop->SetNestableTasksAllowed(did_allow_nestable_tasks); 758 }
759
759 if (timeout_signal->Abort()) { 760 if (timeout_signal->Abort()) {
760 DVLOG(1) << GetClientInfoString("AwaitStatusChangeWithTimeout succeeded"); 761 DVLOG(1) << GetClientInfoString("AwaitStatusChangeWithTimeout succeeded");
761 return true; 762 return true;
762 } else { 763 } else {
763 DVLOG(0) << GetClientInfoString("AwaitStatusChangeWithTimeout timed out"); 764 DVLOG(0) << GetClientInfoString("AwaitStatusChangeWithTimeout timed out");
764 return false; 765 return false;
765 } 766 }
766 } 767 }
767 768
768 ProfileSyncService::Status ProfileSyncServiceHarness::GetStatus() { 769 ProfileSyncService::Status ProfileSyncServiceHarness::GetStatus() {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 return state_map.size(); 1117 return state_map.size();
1117 } 1118 }
1118 1119
1119 std::string ProfileSyncServiceHarness::GetServiceStatus() { 1120 std::string ProfileSyncServiceHarness::GetServiceStatus() {
1120 DictionaryValue value; 1121 DictionaryValue value;
1121 sync_ui_util::ConstructAboutInformation(service_, &value); 1122 sync_ui_util::ConstructAboutInformation(service_, &value);
1122 std::string service_status; 1123 std::string service_status;
1123 base::JSONWriter::Write(&value, true, &service_status); 1124 base::JSONWriter::Write(&value, true, &service_status);
1124 return service_status; 1125 return service_status;
1125 } 1126 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/ui/views/simple_message_box_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698