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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 bool Init() override; | 106 bool Init() override; |
107 int GetNextRoutingID() override; | 107 int GetNextRoutingID() override; |
108 void AddRoute(int32 routing_id, IPC::Listener* listener) override; | 108 void AddRoute(int32 routing_id, IPC::Listener* listener) override; |
109 void RemoveRoute(int32 routing_id) override; | 109 void RemoveRoute(int32 routing_id) override; |
110 void AddObserver(RenderProcessHostObserver* observer) override; | 110 void AddObserver(RenderProcessHostObserver* observer) override; |
111 void RemoveObserver(RenderProcessHostObserver* observer) override; | 111 void RemoveObserver(RenderProcessHostObserver* observer) override; |
112 void ShutdownForBadMessage() override; | 112 void ShutdownForBadMessage() override; |
113 void WidgetRestored() override; | 113 void WidgetRestored() override; |
114 void WidgetHidden() override; | 114 void WidgetHidden() override; |
115 int VisibleWidgetCount() const override; | 115 int VisibleWidgetCount() const override; |
| 116 void AudioStateChanged() override; |
116 bool IsForGuestsOnly() const override; | 117 bool IsForGuestsOnly() const override; |
117 StoragePartition* GetStoragePartition() const override; | 118 StoragePartition* GetStoragePartition() const override; |
118 bool Shutdown(int exit_code, bool wait) override; | 119 bool Shutdown(int exit_code, bool wait) override; |
119 bool FastShutdownIfPossible() override; | 120 bool FastShutdownIfPossible() override; |
120 base::ProcessHandle GetHandle() const override; | 121 base::ProcessHandle GetHandle() const override; |
121 bool IsReady() const override; | 122 bool IsReady() const override; |
122 BrowserContext* GetBrowserContext() const override; | 123 BrowserContext* GetBrowserContext() const override; |
123 bool InSameStoragePartition(StoragePartition* partition) const override; | 124 bool InSameStoragePartition(StoragePartition* partition) const override; |
124 int GetID() const override; | 125 int GetID() const override; |
125 bool HasConnection() const override; | 126 bool HasConnection() const override; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // results to |*command_line|. | 311 // results to |*command_line|. |
311 void AppendRendererCommandLine(base::CommandLine* command_line) const; | 312 void AppendRendererCommandLine(base::CommandLine* command_line) const; |
312 | 313 |
313 // Copies applicable command line switches from the given |browser_cmd| line | 314 // Copies applicable command line switches from the given |browser_cmd| line |
314 // flags to the output |renderer_cmd| line flags. Not all switches will be | 315 // flags to the output |renderer_cmd| line flags. Not all switches will be |
315 // copied over. | 316 // copied over. |
316 void PropagateBrowserCommandLineToRenderer( | 317 void PropagateBrowserCommandLineToRenderer( |
317 const base::CommandLine& browser_cmd, | 318 const base::CommandLine& browser_cmd, |
318 base::CommandLine* renderer_cmd) const; | 319 base::CommandLine* renderer_cmd) const; |
319 | 320 |
320 // Callers can reduce the RenderProcess' priority. | 321 // Inspects the current object state and sets/removes background priority if |
321 void SetBackgrounded(bool backgrounded); | 322 // appropriate. Should be called after any of the involved data members |
| 323 // change. |
| 324 void UpdateProcessPriority(); |
322 | 325 |
323 // Handle termination of our process. | 326 // Handle termination of our process. |
324 void ProcessDied(bool already_dead, RendererClosedDetails* known_details); | 327 void ProcessDied(bool already_dead, RendererClosedDetails* known_details); |
325 | 328 |
326 // GpuSwitchingObserver implementation. | 329 // GpuSwitchingObserver implementation. |
327 void OnGpuSwitched() override; | 330 void OnGpuSwitched() override; |
328 | 331 |
329 #if defined(ENABLE_WEBRTC) | 332 #if defined(ENABLE_WEBRTC) |
330 void OnRegisterAecDumpConsumer(int id); | 333 void OnRegisterAecDumpConsumer(int id); |
331 void OnUnregisterAecDumpConsumer(int id); | 334 void OnUnregisterAecDumpConsumer(int id); |
(...skipping 11 matching lines...) Expand all Loading... |
343 | 346 |
344 // The registered IPC listener objects. When this list is empty, we should | 347 // The registered IPC listener objects. When this list is empty, we should |
345 // delete ourselves. | 348 // delete ourselves. |
346 IDMap<IPC::Listener> listeners_; | 349 IDMap<IPC::Listener> listeners_; |
347 | 350 |
348 // The count of currently visible widgets. Since the host can be a container | 351 // The count of currently visible widgets. Since the host can be a container |
349 // for multiple widgets, it uses this count to determine when it should be | 352 // for multiple widgets, it uses this count to determine when it should be |
350 // backgrounded. | 353 // backgrounded. |
351 int32 visible_widgets_; | 354 int32 visible_widgets_; |
352 | 355 |
353 // Does this process have backgrounded priority. | 356 // Whether this process currently has backgrounded priority. Tracked so that |
354 bool backgrounded_; | 357 // UpdateProcessPriority() can avoid redundantly setting the priority. |
| 358 bool is_process_backgrounded_; |
355 | 359 |
356 // Used to allow a RenderWidgetHost to intercept various messages on the | 360 // Used to allow a RenderWidgetHost to intercept various messages on the |
357 // IO thread. | 361 // IO thread. |
358 scoped_refptr<RenderWidgetHelper> widget_helper_; | 362 scoped_refptr<RenderWidgetHelper> widget_helper_; |
359 | 363 |
360 // The filter for GPU-related messages coming from the renderer. | 364 // The filter for GPU-related messages coming from the renderer. |
361 // Thread safety note: this field is to be accessed from the UI thread. | 365 // Thread safety note: this field is to be accessed from the UI thread. |
362 // We don't keep a reference to it, to avoid it being destroyed on the UI | 366 // We don't keep a reference to it, to avoid it being destroyed on the UI |
363 // thread, but we clear this field when we clear channel_. When channel_ goes | 367 // thread, but we clear this field when we clear channel_. When channel_ goes |
364 // away, it posts a task to the IO thread to destroy it there, so we know that | 368 // away, it posts a task to the IO thread to destroy it there, so we know that |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 bool sent_render_process_ready_; | 502 bool sent_render_process_ready_; |
499 | 503 |
500 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; | 504 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; |
501 | 505 |
502 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 506 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
503 }; | 507 }; |
504 | 508 |
505 } // namespace content | 509 } // namespace content |
506 | 510 |
507 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 511 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
OLD | NEW |