diff options
| author | 2023-10-20 11:47:55 -0400 | |
|---|---|---|
| committer | 2023-10-20 11:49:33 -0400 | |
| commit | cae6da6b235fbb6b42bf8b02b3dc6d5b191395d6 (patch) | |
| tree | e42d8ca61f12d62a01ce5aae6a80c1656113f6f9 /api/api_test.go | |
| parent | f192af2ad2fc78bb71dd09276a54d40fad798964 (diff) | |
[frameworks/base] Make SkiaMemoryTracer::TraceValue own its strings
TraceValue had an unowned pointer to a const char (string). But there
was no guarantee that the string lived long enough for TraceValue's use.
Switch to an owned string type.
Use std::string, even though SkString has a little bit of use in this
class. Using SkString would've resulted in a map that had both types
of string, and converging on the standard seems better anyway.
Update other unowned pointers which often reference TraceValues to
owned strings as well. Use std::optional instead of a possible null.
Leave some raw strings alone:
- The ResourceMap is only used with static strings
- The virtual method overrides require const char*, but they quickly
  convert to owned strings
- The categoryKey constructor still takes a const char*, but also
  converts to an owned string. Based on the current use, it could
  have remained a raw string, but it is later used with now-owned
  strings.
- `entry` is a short lived const char*, which obviously is safe.
Bug: 305919946
Test: adb shell dumpsys gfxinfo
Change-Id: I30b990771cc7f3ccf2769efc5aafb68c957eca9f
Diffstat (limited to 'api/api_test.go')
0 files changed, 0 insertions, 0 deletions