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

Side by Side Diff: content/browser/wake_lock/wake_lock_service_context.h

Issue 2371723002: Power Save Blocker: Eliminate passing ViewAndroid as WeakPtr (Closed)
Patch Set: Rebase Created 4 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_ 5 #ifndef CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_
6 #define CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_ 6 #define CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 24 matching lines...) Expand all
35 ~WakeLockServiceContext() override; 35 ~WakeLockServiceContext() override;
36 36
37 // Creates a WakeLockServiceImpl that is strongly bound to |request|. 37 // Creates a WakeLockServiceImpl that is strongly bound to |request|.
38 void CreateService( 38 void CreateService(
39 int render_process_id, 39 int render_process_id,
40 int render_frame_id, 40 int render_frame_id,
41 mojo::InterfaceRequest<blink::mojom::WakeLockService> request); 41 mojo::InterfaceRequest<blink::mojom::WakeLockService> request);
42 42
43 // WebContentsObserver implementation. 43 // WebContentsObserver implementation.
44 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; 44 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
45 void WebContentsDestroyed() override;
46 45
47 // Requests wake lock for RenderFrame identified by |render_process_id| and 46 // Requests wake lock for RenderFrame identified by |render_process_id| and
48 // |render_frame_id|. 47 // |render_frame_id|.
49 void RequestWakeLock(int render_process_id, int render_frame_id); 48 void RequestWakeLock(int render_process_id, int render_frame_id);
50 49
51 // Cancels wake lock request for RenderFrame identified by 50 // Cancels wake lock request for RenderFrame identified by
52 // |render_process_id| and |render_frame_id|. 51 // |render_process_id| and |render_frame_id|.
53 void CancelWakeLock(int render_process_id, int render_frame_id); 52 void CancelWakeLock(int render_process_id, int render_frame_id);
54 53
55 // Used by tests. 54 // Used by tests.
56 bool HasWakeLockForTests() const; 55 bool HasWakeLockForTests() const;
57 56
58 private: 57 private:
59 void CreateWakeLock(); 58 void CreateWakeLock();
60 void RemoveWakeLock(); 59 void RemoveWakeLock();
61 void UpdateWakeLock(); 60 void UpdateWakeLock();
62 61
63 // Set of (render_process_id, render_frame_id) pairs identifying all 62 // Set of (render_process_id, render_frame_id) pairs identifying all
64 // RenderFrames requesting wake lock. 63 // RenderFrames requesting wake lock.
65 std::set<std::pair<int, int>> frames_requesting_lock_; 64 std::set<std::pair<int, int>> frames_requesting_lock_;
66 65
67 // The actual power save blocker for screen. 66 // The actual power save blocker for screen.
68 std::unique_ptr<device::PowerSaveBlocker> wake_lock_; 67 std::unique_ptr<device::PowerSaveBlocker> wake_lock_;
69 #if defined(OS_ANDROID)
70 std::unique_ptr<base::WeakPtrFactory<ui::ViewAndroid>> view_weak_factory_;
71 #endif
72 68
73 base::WeakPtrFactory<WakeLockServiceContext> weak_factory_; 69 base::WeakPtrFactory<WakeLockServiceContext> weak_factory_;
74 70
75 DISALLOW_COPY_AND_ASSIGN(WakeLockServiceContext); 71 DISALLOW_COPY_AND_ASSIGN(WakeLockServiceContext);
76 }; 72 };
77 73
78 } // namespace content 74 } // namespace content
79 75
80 #endif // CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_ 76 #endif // CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_SERVICE_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/media/media_web_contents_observer.cc ('k') | content/browser/wake_lock/wake_lock_service_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698