cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / components / nacl / loader / nacl_listener.h
blobdf8b04ecaeb0a9eb69bd008566888ca0002f63ae
1 // Copyright 2013 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.
5 #ifndef CHROME_NACL_NACL_LISTENER_H_
6 #define CHROME_NACL_NACL_LISTENER_H_
8 #include <vector>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/synchronization/waitable_event.h"
12 #include "base/threading/thread.h"
13 #include "components/nacl/common/nacl_types.h"
14 #include "ipc/ipc_listener.h"
16 namespace IPC {
17 class SyncChannel;
18 class SyncMessageFilter;
21 // The NaClListener is an IPC channel listener that waits for a
22 // request to start a NaCl module.
23 class NaClListener : public IPC::Listener {
24 public:
25 NaClListener();
26 virtual ~NaClListener();
27 // Listen for a request to launch a NaCl module.
28 void Listen();
30 bool Send(IPC::Message* msg);
32 #if defined(OS_LINUX)
33 void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) {
34 prereserved_sandbox_size_ = prereserved_sandbox_size;
36 #endif
37 #if defined(OS_POSIX)
38 void set_number_of_cores(int number_of_cores) {
39 number_of_cores_ = number_of_cores;
41 #endif
43 private:
44 void OnStart(const nacl::NaClStartParams& params);
45 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
47 // A channel back to the browser.
48 scoped_ptr<IPC::SyncChannel> channel_;
50 // A filter that allows other threads to use the channel.
51 scoped_refptr<IPC::SyncMessageFilter> filter_;
53 base::WaitableEvent shutdown_event_;
54 base::Thread io_thread_;
56 #if defined(OS_LINUX)
57 size_t prereserved_sandbox_size_;
58 #endif
59 #if defined(OS_POSIX)
60 // The outer sandbox on Linux and OSX prevents
61 // sysconf(_SC_NPROCESSORS) from working; in Windows, there are no
62 // problems with invoking GetSystemInfo. Therefore, only in
63 // OS_POSIX do we need to supply the number of cores into the
64 // NaClChromeMainArgs object.
65 int number_of_cores_;
66 #endif
68 // Used to identify what thread we're on.
69 base::MessageLoop* main_loop_;
71 DISALLOW_COPY_AND_ASSIGN(NaClListener);
74 #endif // CHROME_NACL_NACL_LISTENER_H_