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

Side by Side Diff: media/base/android/media_service_throttler.h

Issue 2668813002: Remove LazyInstance usage from media/ (Closed)
Patch Set: Fix presubmit comments. Created 3 years, 10 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
« no previous file with comments | « media/base/android/media_drm_bridge.cc ('k') | media/base/android/media_service_throttler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 MEDIA_BASE_ANDROID_MEDIA_SERVICE_THROTTLER_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_SERVICE_THROTTLER_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_SERVICE_THROTTLER_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_SERVICE_THROTTLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/cancelable_callback.h" 11 #include "base/cancelable_callback.h"
12 #include "base/lazy_instance.h"
13 #include "base/macros.h" 12 #include "base/macros.h"
14 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
15 #include "base/time/tick_clock.h" 14 #include "base/time/tick_clock.h"
16 #include "base/time/time.h" 15 #include "base/time/time.h"
17 #include "media/base/media_export.h" 16 #include "media/base/media_export.h"
18 17
19 namespace media { 18 namespace media {
20 class MediaServerCrashListener; 19 class MediaServerCrashListener;
21 20
22 // The MediaServiceThrottler's purpose is to prevent a compromised process from 21 // The MediaServiceThrottler's purpose is to prevent a compromised process from
(...skipping 28 matching lines...) Expand all
51 50
52 // Test only methods. 51 // Test only methods.
53 void SetTickClockForTesting(base::TickClock* clock); 52 void SetTickClockForTesting(base::TickClock* clock);
54 void ResetInternalStateForTesting(); 53 void ResetInternalStateForTesting();
55 base::TimeDelta GetBaseThrottlingRateForTesting(); 54 base::TimeDelta GetBaseThrottlingRateForTesting();
56 bool IsCrashListenerAliveForTesting(); 55 bool IsCrashListenerAliveForTesting();
57 void SetCrashListenerTaskRunnerForTesting( 56 void SetCrashListenerTaskRunnerForTesting(
58 scoped_refptr<base::SingleThreadTaskRunner> crash_listener_task_runner); 57 scoped_refptr<base::SingleThreadTaskRunner> crash_listener_task_runner);
59 58
60 private: 59 private:
61 friend struct base::DefaultLazyInstanceTraits<MediaServiceThrottler>;
62 friend class MediaServiceThrottlerTest; 60 friend class MediaServiceThrottlerTest;
63 61
64 MediaServiceThrottler(); 62 MediaServiceThrottler();
65 virtual ~MediaServiceThrottler(); 63 virtual ~MediaServiceThrottler();
66 64
67 // Called by the |crash_listener_| whenever a crash is detected. 65 // Called by the |crash_listener_| whenever a crash is detected.
68 void OnMediaServerCrash(bool watchdog_needs_release); 66 void OnMediaServerCrash(bool watchdog_needs_release);
69 67
70 // Updates |current_craches_| according to a linear decay function. 68 // Updates |current_craches_| according to a linear decay function.
71 void UpdateServerCrashes(); 69 void UpdateServerCrashes();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 std::unique_ptr<MediaServerCrashListener> crash_listener_; 107 std::unique_ptr<MediaServerCrashListener> crash_listener_;
110 108
111 scoped_refptr<base::SingleThreadTaskRunner> crash_listener_task_runner_; 109 scoped_refptr<base::SingleThreadTaskRunner> crash_listener_task_runner_;
112 110
113 DISALLOW_COPY_AND_ASSIGN(MediaServiceThrottler); 111 DISALLOW_COPY_AND_ASSIGN(MediaServiceThrottler);
114 }; 112 };
115 113
116 } // namespace media 114 } // namespace media
117 115
118 #endif // MEDIA_BASE_ANDROID_MEDIA_SERVICE_THROTTLER_H_ 116 #endif // MEDIA_BASE_ANDROID_MEDIA_SERVICE_THROTTLER_H_
OLDNEW
« no previous file with comments | « media/base/android/media_drm_bridge.cc ('k') | media/base/android/media_service_throttler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698