summaryrefslogtreecommitdiffstats
path: root/extensions/browser/mojo/keep_alive_impl.cc
blob: 04e496608246e8698c0e9ccf9d0ef9ed8e3e3bd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/browser/mojo/keep_alive_impl.h"

#include "extensions/browser/process_manager.h"

namespace extensions {

// static
void KeepAliveImpl::Create(content::BrowserContext* context,
                           const Extension* extension,
                           mojo::InterfaceRequest<KeepAlive> request) {
  mojo::BindToRequest(new KeepAliveImpl(context, extension), &request);
}

KeepAliveImpl::KeepAliveImpl(content::BrowserContext* context,
                             const Extension* extension)
    : context_(context), extension_(extension) {
  ProcessManager::Get(context_)->IncrementLazyKeepaliveCount(extension_);
}

KeepAliveImpl::~KeepAliveImpl() {
  ProcessManager::Get(context_)->DecrementLazyKeepaliveCount(extension_);
}

}  // namespace extensions