| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ | |
| 6 #define CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/process/process.h" | |
| 13 #include "content/public/browser/browser_child_process_host_delegate.h" | |
| 14 | |
| 15 namespace content { | |
| 16 class BrowserChildProcessHost; | |
| 17 } | |
| 18 | |
| 19 class NaClBrokerHost : public content::BrowserChildProcessHostDelegate { | |
| 20 public: | |
| 21 NaClBrokerHost(); | |
| 22 ~NaClBrokerHost(); | |
| 23 | |
| 24 // This function starts the broker process. It needs to be called | |
| 25 // before loaders can be launched. | |
| 26 bool Init(); | |
| 27 | |
| 28 // Send a message to the broker process, causing it to launch | |
| 29 // a Native Client loader process. | |
| 30 bool LaunchLoader(const std::string& loader_channel_id); | |
| 31 | |
| 32 bool LaunchDebugExceptionHandler(int32 pid, | |
| 33 base::ProcessHandle process_handle, | |
| 34 const std::string& startup_info); | |
| 35 | |
| 36 // Stop the broker process. | |
| 37 void StopBroker(); | |
| 38 | |
| 39 // Returns true if the process has been asked to terminate. If true, this | |
| 40 // object should no longer be used; it will eventually be destroyed by | |
| 41 // BrowserChildProcessHostImpl::OnChildDisconnected() | |
| 42 bool IsTerminating() { return is_terminating_; } | |
| 43 | |
| 44 private: | |
| 45 // Handler for NaClProcessMsg_LoaderLaunched message | |
| 46 void OnLoaderLaunched(const std::string& loader_channel_id, | |
| 47 base::ProcessHandle handle); | |
| 48 // Handler for NaClProcessMsg_DebugExceptionHandlerLaunched message | |
| 49 void OnDebugExceptionHandlerLaunched(int32 pid, bool success); | |
| 50 | |
| 51 // BrowserChildProcessHostDelegate implementation: | |
| 52 virtual bool OnMessageReceived(const IPC::Message& msg); | |
| 53 | |
| 54 scoped_ptr<content::BrowserChildProcessHost> process_; | |
| 55 bool is_terminating_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(NaClBrokerHost); | |
| 58 }; | |
| 59 | |
| 60 #endif // CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ | |
| OLD | NEW |