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

Side by Side Diff: chrome/browser/nacl_host/nacl_process_host.h

Issue 9748012: Fix memory leak when errors happens in NaClProcessHost::Launch. Allow Launch to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/nacl_host/nacl_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ 5 #ifndef CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_
6 #define CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ 6 #define CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 19 matching lines...) Expand all
30 // After that, most of the communication is directly between NaCl plugin 30 // After that, most of the communication is directly between NaCl plugin
31 // running in the renderer and NaCl processes. 31 // running in the renderer and NaCl processes.
32 class NaClProcessHost : public content::BrowserChildProcessHostDelegate { 32 class NaClProcessHost : public content::BrowserChildProcessHostDelegate {
33 public: 33 public:
34 explicit NaClProcessHost(const std::wstring& url); 34 explicit NaClProcessHost(const std::wstring& url);
35 virtual ~NaClProcessHost(); 35 virtual ~NaClProcessHost();
36 36
37 // Do any minimal work that must be done at browser startup. 37 // Do any minimal work that must be done at browser startup.
38 static void EarlyStartup(); 38 static void EarlyStartup();
39 39
40 // Initialize the new NaCl process, returning true on success. On success, 40 // Initialize the new NaCl process. Result is returned by sending ipc
41 // the NaCl process host will assume responsibility for sending the reply 41 // message reply_msg.
42 // message. On failure, the reply will not be sent and this is the caller's 42 void Launch(ChromeRenderMessageFilter* chrome_render_message_filter,
43 // responsibility to avoid hanging the renderer.
44 bool Launch(ChromeRenderMessageFilter* chrome_render_message_filter,
45 int socket_count, 43 int socket_count,
46 IPC::Message* reply_msg); 44 IPC::Message* reply_msg);
47 45
48 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 46 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
49 47
50 void OnProcessLaunchedByBroker(base::ProcessHandle handle); 48 void OnProcessLaunchedByBroker(base::ProcessHandle handle);
51 49
52 private: 50 private:
53 // Internal class that holds the nacl::Handle objecs so that 51 // Internal class that holds the nacl::Handle objecs so that
54 // nacl_process_host.h doesn't include NaCl headers. Needed since it's 52 // nacl_process_host.h doesn't include NaCl headers. Needed since it's
(...skipping 14 matching lines...) Expand all
69 void IrtReady(); 67 void IrtReady();
70 void SendStart(base::PlatformFile irt_file); 68 void SendStart(base::PlatformFile irt_file);
71 69
72 bool IsHardwareExceptionHandlingEnabled(); 70 bool IsHardwareExceptionHandlingEnabled();
73 71
74 private: 72 private:
75 #if defined(OS_WIN) 73 #if defined(OS_WIN)
76 class DebugContext; 74 class DebugContext;
77 75
78 scoped_refptr<DebugContext> debug_context_; 76 scoped_refptr<DebugContext> debug_context_;
77
78 // This field becomes true when the broker successfully launched
79 // the NaCl loader.
80 bool process_launched_by_broker_;
79 #endif 81 #endif
80 // The ChromeRenderMessageFilter that requested this NaCl process. We use 82 // The ChromeRenderMessageFilter that requested this NaCl process. We use
81 // this for sending the reply once the process has started. 83 // this for sending the reply once the process has started.
82 scoped_refptr<ChromeRenderMessageFilter> chrome_render_message_filter_; 84 scoped_refptr<ChromeRenderMessageFilter> chrome_render_message_filter_;
83 85
84 // The reply message to send. We must always send this message when the 86 // The reply message to send. We must always send this message when the
85 // sub-process either succeeds or fails to unblock the renderer waiting for 87 // sub-process either succeeds or fails to unblock the renderer waiting for
86 // the reply. NULL when there is no reply to send. 88 // the reply. NULL when there is no reply to send.
87 IPC::Message* reply_msg_; 89 IPC::Message* reply_msg_;
88 90
89 // Socket pairs for the NaCl process and renderer. 91 // Socket pairs for the NaCl process and renderer.
90 scoped_ptr<NaClInternal> internal_; 92 scoped_ptr<NaClInternal> internal_;
91 93
92 base::WeakPtrFactory<NaClProcessHost> weak_factory_; 94 base::WeakPtrFactory<NaClProcessHost> weak_factory_;
93 95
94 scoped_ptr<content::BrowserChildProcessHost> process_; 96 scoped_ptr<content::BrowserChildProcessHost> process_;
95 97
96 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); 98 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost);
97 }; 99 };
98 100
99 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ 101 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/nacl_host/nacl_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698