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

Side by Side Diff: chrome/browser/chromeos/power/renderer_freezer.h

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_POWER_RENDERER_FREEZER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POWER_RENDERER_FREEZER_H_
6 #define CHROME_BROWSER_CHROMEOS_POWER_RENDERER_FREEZER_H_ 6 #define CHROME_BROWSER_CHROMEOS_POWER_RENDERER_FREEZER_H_
7 7
8 #include <memory>
8 #include <set> 9 #include <set>
9 10
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "base/cancelable_callback.h" 12 #include "base/cancelable_callback.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/process/kill.h" 15 #include "base/process/kill.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "chromeos/chromeos_export.h" 17 #include "chromeos/chromeos_export.h"
18 #include "chromeos/dbus/power_manager_client.h" 18 #include "chromeos/dbus/power_manager_client.h"
19 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
21 #include "content/public/browser/render_process_host_observer.h" 21 #include "content/public/browser/render_process_host_observer.h"
22 22
23 namespace content { 23 namespace content {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // Thaws the chrome renderers that were frozen by the call to 56 // Thaws the chrome renderers that were frozen by the call to
57 // FreezeRenderers(). Performs the operation asynchronously on the FILE 57 // FreezeRenderers(). Performs the operation asynchronously on the FILE
58 // thread and runs |callback| with the result on the UI thread. 58 // thread and runs |callback| with the result on the UI thread.
59 virtual void ThawRenderers(ResultCallback callback) = 0; 59 virtual void ThawRenderers(ResultCallback callback) = 0;
60 60
61 // Asynchronously checks on the FILE thread if the delegate can freeze 61 // Asynchronously checks on the FILE thread if the delegate can freeze
62 // renderers and runs |callback| on the UI thread with the result. 62 // renderers and runs |callback| on the UI thread with the result.
63 virtual void CheckCanFreezeRenderers(ResultCallback callback) = 0; 63 virtual void CheckCanFreezeRenderers(ResultCallback callback) = 0;
64 }; 64 };
65 65
66 explicit RendererFreezer(scoped_ptr<Delegate> delegate); 66 explicit RendererFreezer(std::unique_ptr<Delegate> delegate);
67 ~RendererFreezer() override; 67 ~RendererFreezer() override;
68 68
69 // PowerManagerClient::RenderProcessManagerDelegate implementation. 69 // PowerManagerClient::RenderProcessManagerDelegate implementation.
70 void SuspendImminent() override; 70 void SuspendImminent() override;
71 void SuspendDone() override; 71 void SuspendDone() override;
72 72
73 // content::NotificationObserver implementation. 73 // content::NotificationObserver implementation.
74 void Observe(int type, 74 void Observe(int type,
75 const content::NotificationSource& source, 75 const content::NotificationSource& source,
76 const content::NotificationDetails& details) override; 76 const content::NotificationDetails& details) override;
(...skipping 11 matching lines...) Expand all
88 // Called after thawing the renderers has completed. 88 // Called after thawing the renderers has completed.
89 void OnThawRenderersComplete(bool success); 89 void OnThawRenderersComplete(bool success);
90 90
91 // Called whenever the screen locker is shown or hidden. 91 // Called whenever the screen locker is shown or hidden.
92 void OnScreenLockStateChanged(chromeos::ScreenLocker* locker, bool is_locked); 92 void OnScreenLockStateChanged(chromeos::ScreenLocker* locker, bool is_locked);
93 93
94 // Called whenever a new renderer process is created. 94 // Called whenever a new renderer process is created.
95 void OnRenderProcessCreated(content::RenderProcessHost* rph); 95 void OnRenderProcessCreated(content::RenderProcessHost* rph);
96 96
97 // Delegate that takes care of actually freezing and thawing renderers for us. 97 // Delegate that takes care of actually freezing and thawing renderers for us.
98 scoped_ptr<Delegate> delegate_; 98 std::unique_ptr<Delegate> delegate_;
99 99
100 // Set that keeps track of the RenderProcessHosts for processes that are 100 // Set that keeps track of the RenderProcessHosts for processes that are
101 // hosting GCM extensions. 101 // hosting GCM extensions.
102 std::set<int> gcm_extension_processes_; 102 std::set<int> gcm_extension_processes_;
103 103
104 // Manages notification registrations. 104 // Manages notification registrations.
105 content::NotificationRegistrar registrar_; 105 content::NotificationRegistrar registrar_;
106 106
107 base::WeakPtrFactory<RendererFreezer> weak_factory_; 107 base::WeakPtrFactory<RendererFreezer> weak_factory_;
108 108
109 DISALLOW_COPY_AND_ASSIGN(RendererFreezer); 109 DISALLOW_COPY_AND_ASSIGN(RendererFreezer);
110 }; 110 };
111 111
112 } // namespace chromeos 112 } // namespace chromeos
113 113
114 #endif // CHROME_BROWSER_CHROMEOS_POWER_RENDERER_FREEZER_H_ 114 #endif // CHROME_BROWSER_CHROMEOS_POWER_RENDERER_FREEZER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/power/power_prefs_unittest.cc ('k') | chrome/browser/chromeos/power/renderer_freezer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698