Commit 1dbfd37b authored by fdoray's avatar fdoray Committed by Commit bot

Remove calls to deprecated MessageLoop methods in ios.

This CL (hopefully) removes all calls to these methods in ios:
- MessageLoop::PostTask
- MessageLoop::PostDelayedTask
- MessageLoop::DeleteSoon
- MessageLoop::ReleaseSoon
- MessageLoop::Run
- MessageLoop::RunUntilIdle

BUG=616447
R=sdefresne@chromium.org

Review-Url: https://codereview.chromium.org/2314243002
Cr-Commit-Position: refs/heads/master@{#417305}
parent 8fe7b763
...@@ -360,9 +360,10 @@ void TestChromeBrowserState::DestroyHistoryService() { ...@@ -360,9 +360,10 @@ void TestChromeBrowserState::DestroyHistoryService() {
if (!history_service) if (!history_service)
return; return;
base::RunLoop run_loop;
history_service->ClearCachedDataForContextID(0); history_service->ClearCachedDataForContextID(0);
history_service->SetOnBackendDestroyTask( history_service->SetOnBackendDestroyTask(run_loop.QuitWhenIdleClosure());
base::MessageLoop::QuitWhenIdleClosure());
history_service->Shutdown(); history_service->Shutdown();
history_service = nullptr; history_service = nullptr;
...@@ -374,13 +375,7 @@ void TestChromeBrowserState::DestroyHistoryService() { ...@@ -374,13 +375,7 @@ void TestChromeBrowserState::DestroyHistoryService() {
// moving to the next test. Note: if this never terminates, somebody is // moving to the next test. Note: if this never terminates, somebody is
// probably leaking a reference to the history backend, so it never calls // probably leaking a reference to the history backend, so it never calls
// our destroy task. // our destroy task.
base::MessageLoop::current()->Run(); run_loop.Run();
// Make sure we don't have any event pending that could disrupt the next
// test.
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
base::MessageLoop::current()->Run();
} }
syncable_prefs::TestingPrefServiceSyncable* syncable_prefs::TestingPrefServiceSyncable*
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/memory/ref_counted_memory.h" #include "base/memory/ref_counted_memory.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
...@@ -461,11 +462,11 @@ bool URLDataManagerIOSBackend::StartRequest(const net::URLRequest* request, ...@@ -461,11 +462,11 @@ bool URLDataManagerIOSBackend::StartRequest(const net::URLRequest* request,
// replies are put on the IO thread in the same order. // replies are put on the IO thread in the same order.
base::MessageLoop* target_message_loop = base::MessageLoop* target_message_loop =
web::WebThread::UnsafeGetMessageLoopForThread(web::WebThread::UI); web::WebThread::UnsafeGetMessageLoopForThread(web::WebThread::UI);
target_message_loop->PostTask( target_message_loop->task_runner()->PostTask(
FROM_HERE, base::Bind(&GetMimeTypeOnUI, base::RetainedRef(source), path, FROM_HERE, base::Bind(&GetMimeTypeOnUI, base::RetainedRef(source), path,
job->weak_factory_.GetWeakPtr())); job->weak_factory_.GetWeakPtr()));
target_message_loop->PostTask( target_message_loop->task_runner()->PostTask(
FROM_HERE, base::Bind(&URLDataManagerIOSBackend::CallStartRequest, FROM_HERE, base::Bind(&URLDataManagerIOSBackend::CallStartRequest,
make_scoped_refptr(source), path, request_id)); make_scoped_refptr(source), path, request_id));
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment