LCOV - code coverage report
Current view: directory - ipc/chromium/src/chrome/common - child_process_info.cc (source / functions) Found Hit Coverage
Test: app.info Lines: 18 0 0.0 %
Date: 2012-06-02 Functions: 6 0 0.0 %

       1                 : // Copyright (c) 2009 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.
       4                 : 
       5                 : #include "chrome/common/child_process_info.h"
       6                 : 
       7                 : #include <limits>
       8                 : 
       9                 : #include "base/logging.h"
      10                 : #include "base/process_util.h"
      11                 : #include "base/rand_util.h"
      12                 : #include "base/string_util.h"
      13                 : 
      14               0 : std::wstring ChildProcessInfo::GetTypeNameInEnglish(
      15                 :     ChildProcessInfo::ProcessType type) {
      16               0 :   switch (type) {
      17                 :     case BROWSER_PROCESS:
      18               0 :       return L"Browser";
      19                 :     case RENDER_PROCESS:
      20               0 :       return L"Tab";
      21                 :     case PLUGIN_PROCESS:
      22               0 :       return L"Plug-in";
      23                 :     case WORKER_PROCESS:
      24               0 :       return L"Web Worker";
      25                 :     case UNKNOWN_PROCESS:
      26                 :       default:
      27               0 :       DCHECK(false) << "Unknown child process type!";
      28               0 :       return L"Unknown";
      29                 :     }
      30                 : }
      31                 : 
      32               0 : std::wstring ChildProcessInfo::GetLocalizedTitle() const {
      33               0 :   return name_;
      34                 : }
      35                 : 
      36               0 : ChildProcessInfo::ChildProcessInfo(ProcessType type) {
      37                 :   // This constructor is only used by objects which derive from this class,
      38                 :   // which means *this* is a real object that refers to a child process, and not
      39                 :   // just a simple object that contains information about it.  So add it to our
      40                 :   // list of running processes.
      41               0 :   type_ = type;
      42               0 :   pid_ = -1;
      43               0 : }
      44                 : 
      45                 : 
      46               0 : ChildProcessInfo::~ChildProcessInfo() {
      47               0 : }
      48                 : 
      49               0 : std::wstring ChildProcessInfo::GenerateRandomChannelID(void* instance) {
      50                 :   // Note: the string must start with the current process id, this is how
      51                 :   // child processes determine the pid of the parent.
      52                 :   // Build the channel ID.  This is composed of a unique identifier for the
      53                 :   // parent browser process, an identifier for the child instance, and a random
      54                 :   // component. We use a random component so that a hacked child process can't
      55                 :   // cause denial of service by causing future named pipe creation to fail.
      56                 :   return StringPrintf(L"%d.%x.%d",
      57                 :                       base::GetCurrentProcId(), instance,
      58               0 :                       base::RandInt(0, std::numeric_limits<int>::max()));
      59                 : }

Generated by: LCOV version 1.7