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

Side by Side Diff: components/nacl/browser/nacl_process_host.h

Issue 1094653003: Refactor NaClProcessHost. Reduce chances to leak the resource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ 5 #ifndef COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_
6 #define COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ 6 #define COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #include <vector> 10 #include <vector>
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void OnProcessLaunchedByBroker(base::ProcessHandle handle); 105 void OnProcessLaunchedByBroker(base::ProcessHandle handle);
106 void OnDebugExceptionHandlerLaunchedByBroker(bool success); 106 void OnDebugExceptionHandlerLaunchedByBroker(bool success);
107 #endif 107 #endif
108 108
109 bool Send(IPC::Message* msg); 109 bool Send(IPC::Message* msg);
110 110
111 content::BrowserChildProcessHost* process() { return process_.get(); } 111 content::BrowserChildProcessHost* process() { return process_.get(); }
112 content::BrowserPpapiHost* browser_ppapi_host() { return ppapi_host_.get(); } 112 content::BrowserPpapiHost* browser_ppapi_host() { return ppapi_host_.get(); }
113 113
114 private: 114 private:
115 class ScopedChannelHandle;
116
115 void LaunchNaClGdb(); 117 void LaunchNaClGdb();
116 118
117 // Mark the process as using a particular GDB debug stub port and notify 119 // Mark the process as using a particular GDB debug stub port and notify
118 // listeners (if the port is not kGdbDebugStubPortUnknown). 120 // listeners (if the port is not kGdbDebugStubPortUnknown).
119 void SetDebugStubPort(int port); 121 void SetDebugStubPort(int port);
120 122
121 #if defined(OS_POSIX) 123 #if defined(OS_POSIX)
122 // Create bound TCP socket in the browser process so that the NaCl GDB debug 124 // Create bound TCP socket in the browser process so that the NaCl GDB debug
123 // stub can use it to accept incoming connections even when the Chrome sandbox 125 // stub can use it to accept incoming connections even when the Chrome sandbox
124 // is enabled. 126 // is enabled.
(...skipping 10 matching lines...) Expand all
135 // BrowserChildProcessHostDelegate implementation: 137 // BrowserChildProcessHostDelegate implementation:
136 bool OnMessageReceived(const IPC::Message& msg) override; 138 bool OnMessageReceived(const IPC::Message& msg) override;
137 void OnProcessLaunched() override; 139 void OnProcessLaunched() override;
138 140
139 void OnResourcesReady(); 141 void OnResourcesReady();
140 142
141 // Enable the PPAPI proxy only for NaCl processes corresponding to a renderer. 143 // Enable the PPAPI proxy only for NaCl processes corresponding to a renderer.
142 bool enable_ppapi_proxy() { return render_view_id_ != 0; } 144 bool enable_ppapi_proxy() { return render_view_id_ != 0; }
143 145
144 // Sends the reply message to the renderer who is waiting for the plugin 146 // Sends the reply message to the renderer who is waiting for the plugin
145 // to load. Returns true on success. 147 // to load.
146 bool ReplyToRenderer( 148 void ReplyToRenderer(ScopedChannelHandle ppapi_channel_handle,
147 const IPC::ChannelHandle& ppapi_channel_handle, 149 ScopedChannelHandle trusted_channel_handle,
148 const IPC::ChannelHandle& trusted_channel_handle, 150 ScopedChannelHandle manifest_service_channel_handle);
149 const IPC::ChannelHandle& manifest_service_channel_handle);
150 151
151 // Sends the reply with error message to the renderer. 152 // Sends the reply with error message to the renderer.
152 void SendErrorToRenderer(const std::string& error_message); 153 void SendErrorToRenderer(const std::string& error_message);
153 154
154 // Sends the reply message to the renderer. Either result or 155 // Sends the reply message to the renderer. Either result or
155 // error message must be empty. 156 // error message must be empty.
156 void SendMessageToRenderer(const NaClLaunchResult& result, 157 bool SendMessageToRenderer(const NaClLaunchResult& result,
157 const std::string& error_message); 158 const std::string& error_message);
158 159
159 // Sends the message to the NaCl process to load the plugin. Returns true 160 // Sends the message to the NaCl process to load the plugin. Returns true
160 // on success. 161 // on success.
161 bool StartNaClExecution(); 162 bool StartNaClExecution();
162 163
163 void StartNaClFileResolved( 164 void StartNaClFileResolved(
164 NaClStartParams params, 165 NaClStartParams params,
165 const base::FilePath& file_path, 166 const base::FilePath& file_path,
166 base::File nexe_file); 167 base::File nexe_file);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 base::File socket_for_sel_ldr_; 254 base::File socket_for_sel_ldr_;
254 255
255 base::WeakPtrFactory<NaClProcessHost> weak_factory_; 256 base::WeakPtrFactory<NaClProcessHost> weak_factory_;
256 257
257 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); 258 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost);
258 }; 259 };
259 260
260 } // namespace nacl 261 } // namespace nacl
261 262
262 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ 263 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | components/nacl/browser/nacl_process_host.cc » ('j') | components/nacl/browser/nacl_process_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698