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

Side by Side Diff: content/child/scoped_child_process_reference.cc

Issue 1142063003: content/child: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix. 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/child/scoped_child_process_reference.h" 5 #include "content/child/scoped_child_process_reference.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
8 #include "base/time/time.h" 11 #include "base/time/time.h"
9 #include "content/child/child_process.h" 12 #include "content/child/child_process.h"
10 13
11 namespace content { 14 namespace content {
12 15
13 ScopedChildProcessReference::ScopedChildProcessReference() 16 ScopedChildProcessReference::ScopedChildProcessReference()
14 : has_reference_(true) { 17 : has_reference_(true) {
15 ChildProcess::current()->AddRefProcess(); 18 ChildProcess::current()->AddRefProcess();
16 } 19 }
17 20
18 ScopedChildProcessReference::~ScopedChildProcessReference() { 21 ScopedChildProcessReference::~ScopedChildProcessReference() {
19 if (has_reference_) 22 if (has_reference_)
20 ChildProcess::current()->ReleaseProcess(); 23 ChildProcess::current()->ReleaseProcess();
21 } 24 }
22 25
23 void ScopedChildProcessReference::ReleaseWithDelay( 26 void ScopedChildProcessReference::ReleaseWithDelay(
24 const base::TimeDelta& delay) { 27 const base::TimeDelta& delay) {
25 DCHECK(has_reference_); 28 DCHECK(has_reference_);
26 base::MessageLoop::current()->PostDelayedTask( 29 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
27 FROM_HERE, 30 FROM_HERE, base::Bind(&ChildProcess::ReleaseProcess,
28 base::Bind(&ChildProcess::ReleaseProcess, 31 base::Unretained(ChildProcess::current())),
29 base::Unretained(ChildProcess::current())),
30 delay); 32 delay);
31 has_reference_ = false; 33 has_reference_ = false;
32 } 34 }
33 35
34 } // namespace content 36 } // namespace content
OLDNEW
« no previous file with comments | « content/child/power_monitor_broadcast_source.cc ('k') | content/child/service_worker/service_worker_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698