Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2016 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef ThermalManager_DEFINED | |
| 9 #define ThermalManager_DEFINED | |
| 10 | |
| 11 #include "SkString.h" | |
| 12 #include "SkTArray.h" | |
| 13 | |
| 14 #define USE_THERMAL_MANAGER defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FO R_UNIX) | |
|
djsollen
2016/02/05 04:54:15
It would be more clear to me if you wrote it somet
joshualitt
2016/02/05 13:50:20
Acknowledged.
joshualitt
2016/02/05 13:50:20
Acknowledged.
mtklein
2016/02/05 13:54:21
More than that, Derek's version is legal preproces
| |
| 15 | |
| 16 #if USE_THERMAL_MANAGER | |
| 17 | |
| 18 /* | |
| 19 * This simple class monitors the thermal part of sysfs to ensure we don't trigg er thermal events | |
| 20 */ | |
| 21 | |
| 22 class ThermalManager { | |
| 23 public: | |
| 24 ThermalManager(int32_t threshold = 1); | |
| 25 | |
| 26 bool coolOffIfNecessary(uint32_t sleepInterval = 10, uint32_t maxSleeps = 10 00); | |
|
djsollen
2016/02/05 04:54:15
can you document that the sleep interval is in sec
joshualitt
2016/02/05 13:50:20
Acknowledged.
| |
| 27 | |
| 28 private: | |
| 29 static int32_t OpenFileAndReadInt32(const char* path); | |
| 30 | |
| 31 static int32_t GetTemp(SkString thermalZonePath) { | |
| 32 SkString temperatureFilePath(thermalZonePath); | |
| 33 temperatureFilePath.appendf("/temp"); | |
| 34 return OpenFileAndReadInt32(temperatureFilePath.c_str()); | |
| 35 } | |
| 36 | |
| 37 struct TripPoint { | |
| 38 TripPoint(SkString thermalZoneRoot, SkString pointName, int32_t threshol d); | |
| 39 | |
| 40 bool willTrip(); | |
| 41 | |
| 42 SkString fThermalZoneRoot; | |
| 43 SkString fPointName; | |
| 44 int32_t fBase; | |
| 45 int32_t fPoint; | |
| 46 int32_t fThreshold; | |
| 47 bool fDisabled; | |
| 48 }; | |
| 49 | |
| 50 SkTArray<TripPoint> fTripPoints; | |
| 51 }; | |
| 52 #endif | |
| 53 #endif | |
| OLD | NEW |