Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: content/common/child_process_info.h

Issue 8770027: Get rid of the ChildProcessInfo class. It was carrying unnecessary data, and the fact that some p... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/child_process_host.cc ('k') | content/common/child_process_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 #ifndef CONTENT_COMMON_CHILD_PROCESS_INFO_H_
6 #define CONTENT_COMMON_CHILD_PROCESS_INFO_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/process.h"
12 #include "base/string16.h"
13 #include "content/common/content_export.h"
14 #include "content/public/common/process_type.h"
15
16 // Holds information about a child process.
17 class CONTENT_EXPORT ChildProcessInfo {
18 public:
19 ChildProcessInfo(const ChildProcessInfo& original);
20 virtual ~ChildProcessInfo();
21
22 ChildProcessInfo& operator=(const ChildProcessInfo& original);
23
24 // Returns the type of the process.
25 content::ProcessType type() const { return type_; }
26
27 // Returns the name of the process. i.e. for plugins it might be Flash, while
28 // for workers it might be the domain that it's from.
29 const string16& name() const { return name_; }
30
31 // Returns the version of the exe, this only applies to plugins. Otherwise
32 // the string is empty.
33 const string16& version() const { return version_; }
34
35 // Getter to the process handle.
36 base::ProcessHandle handle() const { return process_.handle(); }
37
38 // Getter to the process ID.
39 int pid() const { return process_.pid(); }
40
41 // The unique identifier for this child process. This identifier is NOT a
42 // process ID, and will be unique for all types of child process for
43 // one run of the browser.
44 int id() const { return id_; }
45
46 void SetProcessBackgrounded() const { process_.SetProcessBackgrounded(true); }
47
48 // Generates a unique channel name for a child renderer/plugin process.
49 // The "instance" pointer value is baked into the channel id.
50 static std::string GenerateRandomChannelID(void* instance);
51
52 // Returns a unique ID to identify a child process. On construction, this
53 // function will be used to generate the id_, but it is also used to generate
54 // IDs for the RenderProcessHost, which doesn't inherit from us, and whose IDs
55 // must be unique for all child processes.
56 //
57 // This function is threadsafe since RenderProcessHost is on the UI thread,
58 // but normally this will be used on the IO thread.
59 static int GenerateChildProcessUniqueId();
60
61 protected:
62 // Derived objects need to use this constructor so we know what type we are.
63 // If the caller has already generated a unique ID for this child process,
64 // it should pass it as the second argument. Otherwise, -1 should be passed
65 // and a unique ID will be automatically generated.
66 ChildProcessInfo(content::ProcessType type, int id);
67
68 void set_type(content::ProcessType type) { type_ = type; }
69 void set_name(const string16& name) { name_ = name; }
70 void set_version(const string16& ver) { version_ = ver; }
71 void set_handle(base::ProcessHandle handle) { process_.set_handle(handle); }
72
73 private:
74 content::ProcessType type_;
75 string16 name_;
76 string16 version_;
77 int id_;
78
79 // The handle to the process.
80 mutable base::Process process_;
81 };
82
83 #endif // CONTENT_COMMON_CHILD_PROCESS_INFO_H_
OLDNEW
« no previous file with comments | « content/common/child_process_host.cc ('k') | content/common/child_process_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698