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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool Init() override; | 105 bool Init() override; |
106 int GetNextRoutingID() override; | 106 int GetNextRoutingID() override; |
107 void AddRoute(int32 routing_id, IPC::Listener* listener) override; | 107 void AddRoute(int32 routing_id, IPC::Listener* listener) override; |
108 void RemoveRoute(int32 routing_id) override; | 108 void RemoveRoute(int32 routing_id) override; |
109 void AddObserver(RenderProcessHostObserver* observer) override; | 109 void AddObserver(RenderProcessHostObserver* observer) override; |
110 void RemoveObserver(RenderProcessHostObserver* observer) override; | 110 void RemoveObserver(RenderProcessHostObserver* observer) override; |
111 void ShutdownForBadMessage() override; | 111 void ShutdownForBadMessage() override; |
112 void WidgetRestored() override; | 112 void WidgetRestored() override; |
113 void WidgetHidden() override; | 113 void WidgetHidden() override; |
114 int VisibleWidgetCount() const override; | 114 int VisibleWidgetCount() const override; |
| 115 void AudioStateChanged() override; |
115 bool IsForGuestsOnly() const override; | 116 bool IsForGuestsOnly() const override; |
116 StoragePartition* GetStoragePartition() const override; | 117 StoragePartition* GetStoragePartition() const override; |
117 bool Shutdown(int exit_code, bool wait) override; | 118 bool Shutdown(int exit_code, bool wait) override; |
118 bool FastShutdownIfPossible() override; | 119 bool FastShutdownIfPossible() override; |
119 base::ProcessHandle GetHandle() const override; | 120 base::ProcessHandle GetHandle() const override; |
120 BrowserContext* GetBrowserContext() const override; | 121 BrowserContext* GetBrowserContext() const override; |
121 bool InSameStoragePartition(StoragePartition* partition) const override; | 122 bool InSameStoragePartition(StoragePartition* partition) const override; |
122 int GetID() const override; | 123 int GetID() const override; |
123 bool HasConnection() const override; | 124 bool HasConnection() const override; |
124 void SetIgnoreInputEvents(bool ignore_input_events) override; | 125 void SetIgnoreInputEvents(bool ignore_input_events) override; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // results to |*command_line|. | 323 // results to |*command_line|. |
323 void AppendRendererCommandLine(base::CommandLine* command_line) const; | 324 void AppendRendererCommandLine(base::CommandLine* command_line) const; |
324 | 325 |
325 // Copies applicable command line switches from the given |browser_cmd| line | 326 // Copies applicable command line switches from the given |browser_cmd| line |
326 // flags to the output |renderer_cmd| line flags. Not all switches will be | 327 // flags to the output |renderer_cmd| line flags. Not all switches will be |
327 // copied over. | 328 // copied over. |
328 void PropagateBrowserCommandLineToRenderer( | 329 void PropagateBrowserCommandLineToRenderer( |
329 const base::CommandLine& browser_cmd, | 330 const base::CommandLine& browser_cmd, |
330 base::CommandLine* renderer_cmd) const; | 331 base::CommandLine* renderer_cmd) const; |
331 | 332 |
332 // Callers can reduce the RenderProcess' priority. | 333 // Inspects the current object state and sets/removes background priority if |
333 void SetBackgrounded(bool backgrounded); | 334 // appropriate. Should be called after any of the involved data members |
| 335 // change. |
| 336 void UpdateProcessPriority(); |
334 | 337 |
335 // Handle termination of our process. | 338 // Handle termination of our process. |
336 void ProcessDied(bool already_dead, RendererClosedDetails* known_details); | 339 void ProcessDied(bool already_dead, RendererClosedDetails* known_details); |
337 | 340 |
338 // GpuSwitchingObserver implementation. | 341 // GpuSwitchingObserver implementation. |
339 void OnGpuSwitched() override; | 342 void OnGpuSwitched() override; |
340 | 343 |
341 #if defined(ENABLE_WEBRTC) | 344 #if defined(ENABLE_WEBRTC) |
342 void OnRegisterAecDumpConsumer(int id); | 345 void OnRegisterAecDumpConsumer(int id); |
343 void OnUnregisterAecDumpConsumer(int id); | 346 void OnUnregisterAecDumpConsumer(int id); |
(...skipping 10 matching lines...) Expand all Loading... |
354 | 357 |
355 // The registered IPC listener objects. When this list is empty, we should | 358 // The registered IPC listener objects. When this list is empty, we should |
356 // delete ourselves. | 359 // delete ourselves. |
357 IDMap<IPC::Listener> listeners_; | 360 IDMap<IPC::Listener> listeners_; |
358 | 361 |
359 // The count of currently visible widgets. Since the host can be a container | 362 // The count of currently visible widgets. Since the host can be a container |
360 // for multiple widgets, it uses this count to determine when it should be | 363 // for multiple widgets, it uses this count to determine when it should be |
361 // backgrounded. | 364 // backgrounded. |
362 int32 visible_widgets_; | 365 int32 visible_widgets_; |
363 | 366 |
364 // Does this process have backgrounded priority. | 367 // Whether this process currently has backgrounded priority. Tracked so that |
365 bool backgrounded_; | 368 // UpdateProcessPriority() can avoid redundantly setting the priority. |
| 369 bool is_process_backgrounded_; |
366 | 370 |
367 // Used to allow a RenderWidgetHost to intercept various messages on the | 371 // Used to allow a RenderWidgetHost to intercept various messages on the |
368 // IO thread. | 372 // IO thread. |
369 scoped_refptr<RenderWidgetHelper> widget_helper_; | 373 scoped_refptr<RenderWidgetHelper> widget_helper_; |
370 | 374 |
371 // The filter for GPU-related messages coming from the renderer. | 375 // The filter for GPU-related messages coming from the renderer. |
372 // Thread safety note: this field is to be accessed from the UI thread. | 376 // Thread safety note: this field is to be accessed from the UI thread. |
373 // We don't keep a reference to it, to avoid it being destroyed on the UI | 377 // We don't keep a reference to it, to avoid it being destroyed on the UI |
374 // thread, but we clear this field when we clear channel_. When channel_ goes | 378 // thread, but we clear this field when we clear channel_. When channel_ goes |
375 // away, it posts a task to the IO thread to destroy it there, so we know that | 379 // away, it posts a task to the IO thread to destroy it there, so we know that |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 #endif | 512 #endif |
509 | 513 |
510 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; | 514 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; |
511 | 515 |
512 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 516 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
513 }; | 517 }; |
514 | 518 |
515 } // namespace content | 519 } // namespace content |
516 | 520 |
517 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 521 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
OLD | NEW |