LCOV - code coverage report
Current view: top level - ipc/chromium/src/chrome/common - child_thread.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 16 27 59.3 %
Date: 2017-07-14 16:53:18 Functions: 4 9 44.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : // Copyright (c) 2009 The Chromium Authors. All rights reserved.
       4             : // Use of this source code is governed by a BSD-style license that can be
       5             : // found in the LICENSE file.
       6             : 
       7             : #include "chrome/common/child_thread.h"
       8             : 
       9             : #include "base/string_util.h"
      10             : #include "base/command_line.h"
      11             : #include "chrome/common/child_process.h"
      12             : #include "chrome/common/chrome_switches.h"
      13             : 
      14           2 : ChildThread::ChildThread(Thread::Options options)
      15             :     : Thread("Chrome_ChildThread"),
      16           2 :       owner_loop_(MessageLoop::current()),
      17           4 :       options_(options) {
      18           2 :   DCHECK(owner_loop_);
      19           4 :   channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValue(
      20           2 :       switches::kProcessChannelID);
      21           2 : }
      22             : 
      23           0 : ChildThread::~ChildThread() {
      24           0 : }
      25             : 
      26           2 : bool ChildThread::Run() {
      27           2 :   bool r = StartWithOptions(options_);
      28           2 :   return r;
      29             : }
      30             : 
      31           0 : void ChildThread::OnChannelError() {
      32           0 :   RefPtr<mozilla::Runnable> task = new MessageLoop::QuitTask();
      33           0 :   owner_loop_->PostTask(task.forget());
      34           0 : }
      35             : 
      36           0 : void ChildThread::OnMessageReceived(IPC::Message&& msg) {
      37           0 : }
      38             : 
      39          21 : ChildThread* ChildThread::current() {
      40          21 :   return ChildProcess::current()->child_thread();
      41             : }
      42             : 
      43           2 : void ChildThread::Init() {
      44           4 :   channel_ = mozilla::MakeUnique<IPC::Channel>(channel_name_,
      45             :                                                IPC::Channel::MODE_CLIENT,
      46           2 :                                                this);
      47             : 
      48           2 : }
      49             : 
      50           0 : void ChildThread::CleanUp() {
      51             :   // Need to destruct the SyncChannel to the browser before we go away because
      52             :   // it caches a pointer to this thread.
      53           0 :   channel_ = nullptr;
      54           0 : }

Generated by: LCOV version 1.13