Flutter Engine
The Flutter Engine
Namespaces | Macros | Functions
MemoryCache.cpp File Reference
#include "src/base/SkBase64.h"
#include "src/core/SkMD5.h"
#include "src/core/SkReadBuffer.h"
#include "src/gpu/ganesh/GrPersistentCacheUtils.h"
#include "tools/gpu/MemoryCache.h"

Go to the source code of this file.

Namespaces

namespace  sk_gpu_test
 

Macros

#define LOG_MEMORY_CACHE   0
 

Functions

static SkString data_to_str (const SkData &data)
 

Macro Definition Documentation

◆ LOG_MEMORY_CACHE

#define LOG_MEMORY_CACHE   0

Definition at line 19 of file MemoryCache.cpp.

Function Documentation

◆ data_to_str()

static SkString data_to_str ( const SkData data)
static

Definition at line 21 of file MemoryCache.cpp.

21 {
22 size_t encodeLength = SkBase64::EncodedSize(data.size());
23 SkString str;
24 str.resize(encodeLength);
25 SkBase64::Encode(data.data(), data.size(), str.data());
26 static constexpr size_t kMaxLength = 60;
27 static constexpr char kTail[] = "...";
28 static const size_t kTailLen = strlen(kTail);
29 bool overlength = encodeLength > kMaxLength;
30 if (overlength) {
31 str = SkString(str.c_str(), kMaxLength - kTailLen);
32 str.append(kTail);
33 }
34 return str;
35}
const char * data() const
Definition: SkString.h:132
void append(const char text[])
Definition: SkString.h:203
void resize(size_t len)
Definition: SkString.cpp:374
const char * c_str() const
Definition: SkString.h:133
static size_t EncodedSize(size_t srcDataLength)
Definition: SkBase64.h:40
static size_t Encode(const void *src, size_t length, void *dst, const char *encode=nullptr)
Definition: SkBase64.cpp:113
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63