Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit cae6da6b authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

[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
parent f192af2a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment