1 // Copyright (c) 2012 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 "chrome/renderer/extensions/chrome_v8_extension_handler.h"
7 #include "base/logging.h"
8 #include "content/public/renderer/render_thread.h"
10 using content::RenderThread
;
12 namespace extensions
{
14 ChromeV8ExtensionHandler::ChromeV8ExtensionHandler()
15 : routing_id_(MSG_ROUTING_NONE
) {
18 ChromeV8ExtensionHandler::~ChromeV8ExtensionHandler() {
19 if (routing_id_
!= MSG_ROUTING_NONE
)
20 RenderThread::Get()->RemoveRoute(routing_id_
);
23 int ChromeV8ExtensionHandler::GetRoutingID() {
24 if (routing_id_
== MSG_ROUTING_NONE
) {
25 routing_id_
= RenderThread::Get()->GenerateRoutingID();
26 RenderThread::Get()->AddRoute(routing_id_
, this);
32 void ChromeV8ExtensionHandler::Send(IPC::Message
* message
) {
33 RenderThread::Get()->Send(message
);
36 } // namespace extensions