| Index: chrome/browser/automation/testing_automation_provider.cc
|
| diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
|
| index 50faa3c661a01925dc8d344aa34343863ecf1a71..d4f7d8701985ed09dbc1d0ef40e915cd26b9798b 100644
|
| --- a/chrome/browser/automation/testing_automation_provider.cc
|
| +++ b/chrome/browser/automation/testing_automation_provider.cc
|
| @@ -2733,12 +2733,10 @@ namespace {
|
| // Used by AutomationProvider::GetBrowserInfo().
|
| class GetChildProcessHostInfoTask : public Task {
|
| public:
|
| - GetChildProcessHostInfoTask(base::WaitableEvent* event,
|
| - ListValue* child_processes)
|
| - : event_(event),
|
| - child_processes_(child_processes) {}
|
| + explicit GetChildProcessHostInfoTask(ListValue* child_processes)
|
| + : child_processes_(child_processes) {}
|
|
|
| - virtual void Run() {
|
| + virtual void Run() OVERRIDE {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) {
|
| // Only add processes which are already started,
|
| @@ -2754,11 +2752,9 @@ class GetChildProcessHostInfoTask : public Task {
|
| item->SetInteger("pid", base::GetProcId(info->handle()));
|
| child_processes_->Append(item);
|
| }
|
| - event_->Signal();
|
| }
|
|
|
| private:
|
| - base::WaitableEvent* const event_; // weak
|
| ListValue* child_processes_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(GetChildProcessHostInfoTask);
|
| @@ -2880,12 +2876,10 @@ void TestingAutomationProvider::GetBrowserInfo(
|
| // Add all child processes in a list of dictionaries, one dictionary item
|
| // per child process.
|
| ListValue* child_processes = new ListValue;
|
| - base::WaitableEvent event(true /* manual reset */,
|
| - false /* not initially signaled */);
|
| CHECK(BrowserThread::PostTask(
|
| BrowserThread::IO, FROM_HERE,
|
| - new GetChildProcessHostInfoTask(&event, child_processes)));
|
| - event.Wait();
|
| + new GetChildProcessHostInfoTask(child_processes)));
|
| + CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::IO));
|
| return_value->Set("child_processes", child_processes);
|
|
|
| // Add all extension processes in a list of dictionaries, one dictionary
|
| @@ -5899,6 +5893,14 @@ void TestingAutomationProvider::SetPolicies(
|
| }
|
| }
|
|
|
| + // OverridePolicies() triggers preference updates, which triggers preference
|
| + // listeners. Some policies (e.g. URLBlacklist) post tasks to other message
|
| + // loops before they start being enforced; make sure those tasks have
|
| + // finished.
|
| + CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::IO));
|
| + CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::FILE));
|
| + CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::IO));
|
| +
|
| reply.SendSuccess(NULL);
|
| #endif // defined(OFFICIAL_BUILD)
|
| }
|
|
|