OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/mojo/keep_alive_impl.h" | 5 #include "extensions/browser/mojo/keep_alive_impl.h" |
6 | 6 |
7 #include "extensions/browser/process_manager.h" | 7 #include "extensions/browser/process_manager.h" |
8 | 8 |
9 namespace extensions { | 9 namespace extensions { |
10 | 10 |
11 // static | 11 // static |
12 void KeepAliveImpl::Create(content::BrowserContext* context, | 12 void KeepAliveImpl::Create(content::BrowserContext* context, |
13 const Extension* extension, | 13 const Extension* extension, |
14 mojo::InterfaceRequest<KeepAlive> request) { | 14 mojo::InterfaceRequest<KeepAlive> request) { |
15 mojo::BindToRequest(new KeepAliveImpl(context, extension), &request); | 15 new KeepAliveImpl(context, extension, request.Pass()); |
16 } | 16 } |
17 | 17 |
18 KeepAliveImpl::KeepAliveImpl(content::BrowserContext* context, | 18 KeepAliveImpl::KeepAliveImpl(content::BrowserContext* context, |
19 const Extension* extension) | 19 const Extension* extension, |
20 : context_(context), extension_(extension) { | 20 mojo::InterfaceRequest<KeepAlive> request) |
| 21 : context_(context), extension_(extension), binding_(this, request.Pass()) { |
21 ProcessManager::Get(context_)->IncrementLazyKeepaliveCount(extension_); | 22 ProcessManager::Get(context_)->IncrementLazyKeepaliveCount(extension_); |
22 } | 23 } |
23 | 24 |
24 KeepAliveImpl::~KeepAliveImpl() { | 25 KeepAliveImpl::~KeepAliveImpl() { |
25 ProcessManager::Get(context_)->DecrementLazyKeepaliveCount(extension_); | 26 ProcessManager::Get(context_)->DecrementLazyKeepaliveCount(extension_); |
26 } | 27 } |
27 | 28 |
28 } // namespace extensions | 29 } // namespace extensions |
OLD | NEW |