OLD | NEW |
---|---|
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 CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "ipc/ipc_channel_proxy.h" | 21 #include "ipc/ipc_channel_proxy.h" |
22 #include "ipc/ipc_platform_file.h" | 22 #include "ipc/ipc_platform_file.h" |
23 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h" | 23 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h" |
24 #include "ui/gfx/gpu_memory_buffer.h" | 24 #include "ui/gfx/gpu_memory_buffer.h" |
25 #include "ui/gl/gpu_switching_observer.h" | 25 #include "ui/gl/gpu_switching_observer.h" |
26 | 26 |
27 #if defined(OS_MACOSX) && !defined(OS_IOS) | 27 #if defined(OS_MACOSX) && !defined(OS_IOS) |
28 #include "content/common/mac/io_surface_manager_token.h" | 28 #include "content/common/mac/io_surface_manager_token.h" |
29 #endif | 29 #endif |
30 | 30 |
31 #if defined(OS_MACOSX) | |
32 #include "content/browser/mach_broker_mac.h" | |
33 #endif | |
34 | |
31 namespace base { | 35 namespace base { |
32 class CommandLine; | 36 class CommandLine; |
33 class MessageLoop; | 37 class MessageLoop; |
34 } | 38 } |
35 | 39 |
36 namespace gfx { | 40 namespace gfx { |
37 class Size; | 41 class Size; |
38 } | 42 } |
39 | 43 |
40 namespace gpu { | 44 namespace gpu { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 bool Init() override; | 109 bool Init() override; |
106 int GetNextRoutingID() override; | 110 int GetNextRoutingID() override; |
107 void AddRoute(int32 routing_id, IPC::Listener* listener) override; | 111 void AddRoute(int32 routing_id, IPC::Listener* listener) override; |
108 void RemoveRoute(int32 routing_id) override; | 112 void RemoveRoute(int32 routing_id) override; |
109 void AddObserver(RenderProcessHostObserver* observer) override; | 113 void AddObserver(RenderProcessHostObserver* observer) override; |
110 void RemoveObserver(RenderProcessHostObserver* observer) override; | 114 void RemoveObserver(RenderProcessHostObserver* observer) override; |
111 void ShutdownForBadMessage() override; | 115 void ShutdownForBadMessage() override; |
112 void WidgetRestored() override; | 116 void WidgetRestored() override; |
113 void WidgetHidden() override; | 117 void WidgetHidden() override; |
114 int VisibleWidgetCount() const override; | 118 int VisibleWidgetCount() const override; |
119 void AudioStateChanged() override; | |
115 bool IsForGuestsOnly() const override; | 120 bool IsForGuestsOnly() const override; |
116 StoragePartition* GetStoragePartition() const override; | 121 StoragePartition* GetStoragePartition() const override; |
117 bool Shutdown(int exit_code, bool wait) override; | 122 bool Shutdown(int exit_code, bool wait) override; |
118 bool FastShutdownIfPossible() override; | 123 bool FastShutdownIfPossible() override; |
119 base::ProcessHandle GetHandle() const override; | 124 base::ProcessHandle GetHandle() const override; |
120 BrowserContext* GetBrowserContext() const override; | 125 BrowserContext* GetBrowserContext() const override; |
121 bool InSameStoragePartition(StoragePartition* partition) const override; | 126 bool InSameStoragePartition(StoragePartition* partition) const override; |
122 int GetID() const override; | 127 int GetID() const override; |
123 bool HasConnection() const override; | 128 bool HasConnection() const override; |
124 void SetIgnoreInputEvents(bool ignore_input_events) override; | 129 void SetIgnoreInputEvents(bool ignore_input_events) override; |
(...skipping 26 matching lines...) Expand all Loading... | |
151 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override; | 156 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override; |
152 bool SubscribeUniformEnabled() const override; | 157 bool SubscribeUniformEnabled() const override; |
153 void OnAddSubscription(unsigned int target) override; | 158 void OnAddSubscription(unsigned int target) override; |
154 void OnRemoveSubscription(unsigned int target) override; | 159 void OnRemoveSubscription(unsigned int target) override; |
155 void SendUpdateValueState( | 160 void SendUpdateValueState( |
156 unsigned int target, const gpu::ValueState& state) override; | 161 unsigned int target, const gpu::ValueState& state) override; |
157 #if defined(ENABLE_BROWSER_CDMS) | 162 #if defined(ENABLE_BROWSER_CDMS) |
158 media::BrowserCdm* GetBrowserCdm(int render_frame_id, | 163 media::BrowserCdm* GetBrowserCdm(int render_frame_id, |
159 int cdm_id) const override; | 164 int cdm_id) const override; |
160 #endif | 165 #endif |
166 #if defined(OS_MACOSX) | |
167 mach_port_t GetMachTaskPortForTesting() const override; | |
gab
2015/08/24 20:59:22
Only need #include <mach/mach.h> for |mach_port_t|
Robert Sesek
2015/08/24 21:44:48
Correct. And there's already an #if for OS_MACOSX
sebsg
2015/08/25 01:35:59
In fact, I don't think I need to include mach/mach
sebsg
2015/08/25 01:35:59
Acknowledged.
| |
168 #endif | |
161 | 169 |
162 // IPC::Sender via RenderProcessHost. | 170 // IPC::Sender via RenderProcessHost. |
163 bool Send(IPC::Message* msg) override; | 171 bool Send(IPC::Message* msg) override; |
164 | 172 |
165 // IPC::Listener via RenderProcessHost. | 173 // IPC::Listener via RenderProcessHost. |
166 bool OnMessageReceived(const IPC::Message& msg) override; | 174 bool OnMessageReceived(const IPC::Message& msg) override; |
167 void OnChannelConnected(int32 peer_pid) override; | 175 void OnChannelConnected(int32 peer_pid) override; |
168 void OnChannelError() override; | 176 void OnChannelError() override; |
169 void OnBadMessageReceived(const IPC::Message& message) override; | 177 void OnBadMessageReceived(const IPC::Message& message) override; |
170 | 178 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 // results to |*command_line|. | 324 // results to |*command_line|. |
317 void AppendRendererCommandLine(base::CommandLine* command_line) const; | 325 void AppendRendererCommandLine(base::CommandLine* command_line) const; |
318 | 326 |
319 // Copies applicable command line switches from the given |browser_cmd| line | 327 // Copies applicable command line switches from the given |browser_cmd| line |
320 // flags to the output |renderer_cmd| line flags. Not all switches will be | 328 // flags to the output |renderer_cmd| line flags. Not all switches will be |
321 // copied over. | 329 // copied over. |
322 void PropagateBrowserCommandLineToRenderer( | 330 void PropagateBrowserCommandLineToRenderer( |
323 const base::CommandLine& browser_cmd, | 331 const base::CommandLine& browser_cmd, |
324 base::CommandLine* renderer_cmd) const; | 332 base::CommandLine* renderer_cmd) const; |
325 | 333 |
326 // Callers can reduce the RenderProcess' priority. | 334 // Inspects the current object state and sets/removes background priority if |
327 void SetBackgrounded(bool backgrounded); | 335 // appropriate. Should be called after any of the involved data members |
336 // change. | |
337 void UpdateProcessPriority(); | |
328 | 338 |
329 // Handle termination of our process. | 339 // Handle termination of our process. |
330 void ProcessDied(bool already_dead, RendererClosedDetails* known_details); | 340 void ProcessDied(bool already_dead, RendererClosedDetails* known_details); |
331 | 341 |
332 // GpuSwitchingObserver implementation. | 342 // GpuSwitchingObserver implementation. |
333 void OnGpuSwitched() override; | 343 void OnGpuSwitched() override; |
334 | 344 |
335 #if defined(ENABLE_WEBRTC) | 345 #if defined(ENABLE_WEBRTC) |
336 void OnRegisterAecDumpConsumer(int id); | 346 void OnRegisterAecDumpConsumer(int id); |
337 void OnUnregisterAecDumpConsumer(int id); | 347 void OnUnregisterAecDumpConsumer(int id); |
(...skipping 10 matching lines...) Expand all Loading... | |
348 | 358 |
349 // The registered IPC listener objects. When this list is empty, we should | 359 // The registered IPC listener objects. When this list is empty, we should |
350 // delete ourselves. | 360 // delete ourselves. |
351 IDMap<IPC::Listener> listeners_; | 361 IDMap<IPC::Listener> listeners_; |
352 | 362 |
353 // The count of currently visible widgets. Since the host can be a container | 363 // The count of currently visible widgets. Since the host can be a container |
354 // for multiple widgets, it uses this count to determine when it should be | 364 // for multiple widgets, it uses this count to determine when it should be |
355 // backgrounded. | 365 // backgrounded. |
356 int32 visible_widgets_; | 366 int32 visible_widgets_; |
357 | 367 |
358 // Does this process have backgrounded priority. | 368 // Whether this process currently has backgrounded priority. Tracked so that |
359 bool backgrounded_; | 369 // UpdateProcessPriority() can avoid redundantly setting the priority. |
370 bool is_process_backgrounded_; | |
360 | 371 |
361 // Used to allow a RenderWidgetHost to intercept various messages on the | 372 // Used to allow a RenderWidgetHost to intercept various messages on the |
362 // IO thread. | 373 // IO thread. |
363 scoped_refptr<RenderWidgetHelper> widget_helper_; | 374 scoped_refptr<RenderWidgetHelper> widget_helper_; |
364 | 375 |
365 // The filter for GPU-related messages coming from the renderer. | 376 // The filter for GPU-related messages coming from the renderer. |
366 // Thread safety note: this field is to be accessed from the UI thread. | 377 // Thread safety note: this field is to be accessed from the UI thread. |
367 // We don't keep a reference to it, to avoid it being destroyed on the UI | 378 // We don't keep a reference to it, to avoid it being destroyed on the UI |
368 // thread, but we clear this field when we clear channel_. When channel_ goes | 379 // thread, but we clear this field when we clear channel_. When channel_ goes |
369 // away, it posts a task to the IO thread to destroy it there, so we know that | 380 // away, it posts a task to the IO thread to destroy it there, so we know that |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 #endif | 509 #endif |
499 | 510 |
500 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; | 511 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; |
501 | 512 |
502 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 513 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
503 }; | 514 }; |
504 | 515 |
505 } // namespace content | 516 } // namespace content |
506 | 517 |
507 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 518 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
OLD | NEW |