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

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, 7 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void OnProcessLaunchedByBroker(base::ProcessHandle handle); 104 void OnProcessLaunchedByBroker(base::ProcessHandle handle);
105 void OnDebugExceptionHandlerLaunchedByBroker(bool success); 105 void OnDebugExceptionHandlerLaunchedByBroker(bool success);
106 #endif 106 #endif
107 107
108 bool Send(IPC::Message* msg); 108 bool Send(IPC::Message* msg);
109 109
110 content::BrowserChildProcessHost* process() { return process_.get(); } 110 content::BrowserChildProcessHost* process() { return process_.get(); }
111 content::BrowserPpapiHost* browser_ppapi_host() { return ppapi_host_.get(); } 111 content::BrowserPpapiHost* browser_ppapi_host() { return ppapi_host_.get(); }
112 112
113 private: 113 private:
114 class ScopedChannelHandle;
115
114 void LaunchNaClGdb(); 116 void LaunchNaClGdb();
115 117
116 // Mark the process as using a particular GDB debug stub port and notify 118 // Mark the process as using a particular GDB debug stub port and notify
117 // listeners (if the port is not kGdbDebugStubPortUnknown). 119 // listeners (if the port is not kGdbDebugStubPortUnknown).
118 void SetDebugStubPort(int port); 120 void SetDebugStubPort(int port);
119 121
120 #if defined(OS_POSIX) 122 #if defined(OS_POSIX)
121 // Create bound TCP socket in the browser process so that the NaCl GDB debug 123 // Create bound TCP socket in the browser process so that the NaCl GDB debug
122 // stub can use it to accept incoming connections even when the Chrome sandbox 124 // stub can use it to accept incoming connections even when the Chrome sandbox
123 // is enabled. 125 // is enabled.
(...skipping 11 matching lines...) Expand all
135 bool OnMessageReceived(const IPC::Message& msg) override; 137 bool OnMessageReceived(const IPC::Message& msg) override;
136 void OnProcessLaunched() override; 138 void OnProcessLaunched() override;
137 139
138 void OnResourcesReady(); 140 void OnResourcesReady();
139 141
140 // Enable the PPAPI proxy only for NaCl processes corresponding to a renderer. 142 // Enable the PPAPI proxy only for NaCl processes corresponding to a renderer.
141 bool enable_ppapi_proxy() { return render_view_id_ != 0; } 143 bool enable_ppapi_proxy() { return render_view_id_ != 0; }
142 144
143 // Sends the reply message to the renderer who is waiting for the plugin 145 // Sends the reply message to the renderer who is waiting for the plugin
144 // to load. Returns true on success. 146 // to load. Returns true on success.
145 bool ReplyToRenderer( 147 void ReplyToRenderer(
146 const IPC::ChannelHandle& ppapi_channel_handle, 148 ScopedChannelHandle ppapi_channel_handle,
147 const IPC::ChannelHandle& trusted_channel_handle, 149 ScopedChannelHandle trusted_channel_handle,
148 const IPC::ChannelHandle& manifest_service_channel_handle); 150 ScopedChannelHandle manifest_service_channel_handle);
149 151
150 // Sends the reply with error message to the renderer. 152 // Sends the reply with error message to the renderer.
151 void SendErrorToRenderer(const std::string& error_message); 153 void SendErrorToRenderer(const std::string& error_message);
152 154
153 // Sends the reply message to the renderer. Either result or 155 // Sends the reply message to the renderer. Either result or
154 // error message must be empty. 156 // error message must be empty.
155 void SendMessageToRenderer(const NaClLaunchResult& result, 157 void SendMessageToRenderer(const NaClLaunchResult& result,
156 const std::string& error_message); 158 const std::string& error_message);
157 159
158 // 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
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 base::File socket_for_sel_ldr_; 254 base::File socket_for_sel_ldr_;
253 255
254 base::WeakPtrFactory<NaClProcessHost> weak_factory_; 256 base::WeakPtrFactory<NaClProcessHost> weak_factory_;
255 257
256 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); 258 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost);
257 }; 259 };
258 260
259 } // namespace nacl 261 } // namespace nacl
260 262
261 #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