Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.h

Issue 1214883004: Fixed the audio backgrounding bug (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and fixed the tests for macosx Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // results to |*command_line|. 317 // results to |*command_line|.
317 void AppendRendererCommandLine(base::CommandLine* command_line) const; 318 void AppendRendererCommandLine(base::CommandLine* command_line) const;
318 319
319 // Copies applicable command line switches from the given |browser_cmd| line 320 // 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 321 // flags to the output |renderer_cmd| line flags. Not all switches will be
321 // copied over. 322 // copied over.
322 void PropagateBrowserCommandLineToRenderer( 323 void PropagateBrowserCommandLineToRenderer(
323 const base::CommandLine& browser_cmd, 324 const base::CommandLine& browser_cmd,
324 base::CommandLine* renderer_cmd) const; 325 base::CommandLine* renderer_cmd) const;
325 326
326 // Callers can reduce the RenderProcess' priority. 327 // Inspects the current object state and sets/removes background priority if
327 void SetBackgrounded(bool backgrounded); 328 // appropriate. Should be called after any of the involved data members
329 // change.
330 void UpdateProcessPriority();
328 331
329 // Handle termination of our process. 332 // Handle termination of our process.
330 void ProcessDied(bool already_dead, RendererClosedDetails* known_details); 333 void ProcessDied(bool already_dead, RendererClosedDetails* known_details);
331 334
332 // GpuSwitchingObserver implementation. 335 // GpuSwitchingObserver implementation.
333 void OnGpuSwitched() override; 336 void OnGpuSwitched() override;
334 337
335 #if defined(ENABLE_WEBRTC) 338 #if defined(ENABLE_WEBRTC)
336 void OnRegisterAecDumpConsumer(int id); 339 void OnRegisterAecDumpConsumer(int id);
337 void OnUnregisterAecDumpConsumer(int id); 340 void OnUnregisterAecDumpConsumer(int id);
(...skipping 10 matching lines...) Expand all
348 351
349 // The registered IPC listener objects. When this list is empty, we should 352 // The registered IPC listener objects. When this list is empty, we should
350 // delete ourselves. 353 // delete ourselves.
351 IDMap<IPC::Listener> listeners_; 354 IDMap<IPC::Listener> listeners_;
352 355
353 // The count of currently visible widgets. Since the host can be a container 356 // 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 357 // for multiple widgets, it uses this count to determine when it should be
355 // backgrounded. 358 // backgrounded.
356 int32 visible_widgets_; 359 int32 visible_widgets_;
357 360
358 // Does this process have backgrounded priority. 361 // Whether this process currently has backgrounded priority. Tracked so that
gab 2015/08/07 19:55:06 s/has backgrounded priority/is backgrounded/
359 bool backgrounded_; 362 // UpdateProcessPriority() can avoid redundantly setting the priority.
gab 2015/08/07 19:55:06 Don't document "why" it's tracked, just state what
363 bool is_process_backgrounded_;
360 364
361 // Used to allow a RenderWidgetHost to intercept various messages on the 365 // Used to allow a RenderWidgetHost to intercept various messages on the
362 // IO thread. 366 // IO thread.
363 scoped_refptr<RenderWidgetHelper> widget_helper_; 367 scoped_refptr<RenderWidgetHelper> widget_helper_;
364 368
365 // The filter for GPU-related messages coming from the renderer. 369 // The filter for GPU-related messages coming from the renderer.
366 // Thread safety note: this field is to be accessed from the UI thread. 370 // 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 371 // 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 372 // 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 373 // 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
498 #endif 502 #endif
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698