Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
GN rework
  • Loading branch information
kjlubick committed Oct 4, 2023
commit bedf953c5c0895c1faf81f13a5569da38b5859d9
1 change: 1 addition & 0 deletions common/graphics/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ source_set("graphics") {
"//flutter/display_list",
"//flutter/fml",
"//flutter/shell/version:version",
"//flutter/shell/common:base64",
"//third_party/boringssl",
"//third_party/rapidjson",
"//third_party/skia",
Expand Down
16 changes: 8 additions & 8 deletions common/graphics/persistent_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#include "flutter/fml/paths.h"
#include "flutter/fml/trace_event.h"
#include "flutter/shell/version/version.h"
#include "flutter/shell/common/base64.h"
#include "openssl/sha.h"
#include "rapidjson/document.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "third_party/skia/include/utils/SkBase64.h"

namespace flutter {

Expand Down Expand Up @@ -169,21 +169,21 @@ sk_sp<SkData> ParseBase32(const std::string& input) {
}

sk_sp<SkData> ParseBase64(const std::string& input) {
SkBase64::Error error;
Base64::Error error;

size_t output_len;
error = SkBase64::Decode(input.c_str(), input.length(), nullptr, &output_len);
if (error != SkBase64::Error::kNoError) {
FML_LOG(ERROR) << "Base64 decode error: " << error;
error = Base64::Decode(input.c_str(), input.length(), nullptr, &output_len);
if (error != Base64::Error::kNone) {
FML_LOG(ERROR) << "Base64 decode error: " << (int)error;
FML_LOG(ERROR) << "Base64 can't decode: " << input;
return nullptr;
}

sk_sp<SkData> data = SkData::MakeUninitialized(output_len);
void* output = data->writable_data();
error = SkBase64::Decode(input.c_str(), input.length(), output, &output_len);
if (error != SkBase64::Error::kNoError) {
FML_LOG(ERROR) << "Base64 decode error: " << error;
error = Base64::Decode(input.c_str(), input.length(), output, &output_len);
if (error != Base64::Error::kNone) {
FML_LOG(ERROR) << "Base64 decode error: " << (int)error;
FML_LOG(ERROR) << "Base64 can't decode: " << input;
return nullptr;
}
Expand Down
12 changes: 10 additions & 2 deletions shell/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ source_set("common") {
sources = [
"animator.cc",
"animator.h",
"base64.cc",
"base64.h",
"context_options.cc",
"context_options.h",
"display_manager.cc",
Expand Down Expand Up @@ -146,6 +144,7 @@ source_set("common") {
"//flutter/lib/ui",
"//flutter/runtime",
"//flutter/shell/profiling",
"//flutter/shell/common:base64",
"//third_party/dart/runtime:dart_api",
"//third_party/skia",
]
Expand All @@ -160,6 +159,14 @@ source_set("common") {
}
}

# These are in their own source_set to avoid a dependency cycle with //common/graphics
source_set("base64") {
sources = [
"base64.cc",
"base64.h",
]
}

template("shell_host_executable") {
executable(target_name) {
testonly = true
Expand Down Expand Up @@ -315,6 +322,7 @@ if (enable_unittests) {
":shell_unittests_fixtures",
"//flutter/assets",
"//flutter/common/graphics",
"//flutter/shell/common:base64",
"//flutter/shell/profiling:profiling_unittests",
"//flutter/shell/version",
"//flutter/testing:fixture_test",
Expand Down
6 changes: 3 additions & 3 deletions shell/common/base64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "shell/common/base64.h"
#include "flutter/shell/common/base64.h"

#include "fml/logging.h"
#include "flutter/fml/logging.h"

#include <cstdint>

Expand Down Expand Up @@ -158,4 +158,4 @@ size_t Base64::Encode(const void* srcv, size_t length, void* dstv) {
return (length + 2) / 3 * 4;
}

} // namespace flutter
} // namespace flutter