[sql] Disable worker-thread code in SQLite.
[chromium-blink-merge.git] / extensions / renderer / lazy_background_page_native_handler.cc
blob1e2192152b76d9100f7e4bf8b125fd0a6dd1fcfa
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
3 // found in the LICENSE file.
5 #include "extensions/renderer/lazy_background_page_native_handler.h"
7 #include "base/bind.h"
8 #include "content/public/renderer/render_view.h"
9 #include "extensions/common/extension_messages.h"
10 #include "extensions/renderer/extension_frame_helper.h"
11 #include "extensions/renderer/script_context.h"
13 namespace extensions {
15 LazyBackgroundPageNativeHandler::LazyBackgroundPageNativeHandler(
16 ScriptContext* context)
17 : ObjectBackedNativeHandler(context) {
18 RouteFunction(
19 "IncrementKeepaliveCount",
20 base::Bind(&LazyBackgroundPageNativeHandler::IncrementKeepaliveCount,
21 base::Unretained(this)));
22 RouteFunction(
23 "DecrementKeepaliveCount",
24 base::Bind(&LazyBackgroundPageNativeHandler::DecrementKeepaliveCount,
25 base::Unretained(this)));
28 void LazyBackgroundPageNativeHandler::IncrementKeepaliveCount(
29 const v8::FunctionCallbackInfo<v8::Value>& args) {
30 if (context() && ExtensionFrameHelper::IsContextForEventPage(context())) {
31 content::RenderView* render_view = context()->GetRenderView();
32 render_view->Send(new ExtensionHostMsg_IncrementLazyKeepaliveCount(
33 render_view->GetRoutingID()));
37 void LazyBackgroundPageNativeHandler::DecrementKeepaliveCount(
38 const v8::FunctionCallbackInfo<v8::Value>& args) {
39 if (context() && ExtensionFrameHelper::IsContextForEventPage(context())) {
40 content::RenderView* render_view = context()->GetRenderView();
41 render_view->Send(new ExtensionHostMsg_DecrementLazyKeepaliveCount(
42 render_view->GetRoutingID()));
46 } // namespace extensions