Revert 285173 "Removed InProcessBrowserTest::CleanUpOnMainThread()"
[chromium-blink-merge.git] / chrome / browser / extensions / api / messaging / native_message_port.cc
bloba0a47d561bbb77cad1e495fcaad3a1a5bb46da41
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/browser/extensions/api/messaging/native_message_port.h"
7 #include "base/bind.h"
8 #include "chrome/browser/extensions/api/messaging/native_message_process_host.h"
9 #include "content/public/browser/browser_thread.h"
11 namespace extensions {
13 NativeMessagePort::NativeMessagePort(NativeMessageProcessHost* native_process)
14 : native_process_(native_process) {
17 NativeMessagePort::~NativeMessagePort() {
18 content::BrowserThread::DeleteSoon(
19 content::BrowserThread::IO, FROM_HERE, native_process_);
22 void NativeMessagePort::DispatchOnMessage(
23 const Message& message,
24 int target_port_id) {
25 content::BrowserThread::PostTask(
26 content::BrowserThread::IO, FROM_HERE,
27 base::Bind(&NativeMessageProcessHost::Send,
28 base::Unretained(native_process_), message.data));
31 } // namespace extensions