Add //flutter/content_handler (flutter/engine#2923)
We're now producing a flutter_content_handler binary for Fuchsia that builds and links.
This commit is contained in:
@@ -8,6 +8,7 @@ group("flutter") {
|
||||
if (is_fuchsia) {
|
||||
# TODO(abarth) Remove this specific list once Fuchsia can build everything.
|
||||
deps = [
|
||||
"//flutter/content_handler",
|
||||
"//flutter/flow",
|
||||
"//flutter/runtime",
|
||||
"//flutter/snapshotter",
|
||||
|
||||
@@ -6,8 +6,6 @@ source_set("flow") {
|
||||
sources = [
|
||||
"compositor_context.cc",
|
||||
"compositor_context.h",
|
||||
"gl_connection.cc",
|
||||
"gl_connection.h",
|
||||
"instrumentation.cc",
|
||||
"instrumentation.h",
|
||||
"layers/backdrop_filter_layer.cc",
|
||||
@@ -38,10 +36,10 @@ source_set("flow") {
|
||||
"layers/shader_mask_layer.h",
|
||||
"layers/transform_layer.cc",
|
||||
"layers/transform_layer.h",
|
||||
"open_gl.h",
|
||||
"raster_cache.cc",
|
||||
"raster_cache.h",
|
||||
"texture_image.cc",
|
||||
"bitmap_image.cc",
|
||||
"bitmap_image.h",
|
||||
"texture_image.h",
|
||||
]
|
||||
|
||||
@@ -53,11 +51,15 @@ source_set("flow") {
|
||||
]
|
||||
|
||||
if (is_fuchsia) {
|
||||
# TODO(abarth): In principle, we should add "//mojo/public/c/gpu" as a
|
||||
# dependency, but that doesn't work currently because GPU support on Fuchsia
|
||||
# is still a work in progress.
|
||||
include_dirs = [
|
||||
"//mojo/public/c/gpu",
|
||||
sources += [
|
||||
"texture_image_none.cc",
|
||||
]
|
||||
} else {
|
||||
sources += [
|
||||
"gl_connection.cc",
|
||||
"gl_connection.h",
|
||||
"open_gl.h",
|
||||
"texture_image_gles2.cc",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
16
engine/src/flutter/flow/bitmap_image.cc
Normal file
16
engine/src/flutter/flow/bitmap_image.cc
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/flow/bitmap_image.h"
|
||||
|
||||
namespace flow {
|
||||
|
||||
sk_sp<SkImage> BitmapImageCreate(SkImageGenerator& generator) {
|
||||
SkBitmap bitmap;
|
||||
if (generator.tryGenerateBitmap(&bitmap))
|
||||
return SkImage::MakeFromBitmap(bitmap);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace flow
|
||||
17
engine/src/flutter/flow/bitmap_image.h
Normal file
17
engine/src/flutter/flow/bitmap_image.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef FLUTTER_FLOW_BITMAP_IMAGE_H_
|
||||
#define FLUTTER_FLOW_BITMAP_IMAGE_H_
|
||||
|
||||
#include "third_party/skia/include/core/SkImage.h"
|
||||
#include "third_party/skia/include/core/SkImageGenerator.h"
|
||||
|
||||
namespace flow {
|
||||
|
||||
sk_sp<SkImage> BitmapImageCreate(SkImageGenerator& generator);
|
||||
|
||||
} // namespace flow
|
||||
|
||||
#endif // FLUTTER_FLOW_BITMAP_IMAGE_H_
|
||||
@@ -13,8 +13,6 @@ namespace flow {
|
||||
sk_sp<SkImage> TextureImageCreate(GrContext* context,
|
||||
SkImageGenerator& generator);
|
||||
|
||||
sk_sp<SkImage> BitmapImageCreate(SkImageGenerator& generator);
|
||||
|
||||
} // namespace flow
|
||||
|
||||
#endif // FLUTTER_FLOW_TEXTURE_IMAGE_H_
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/flow/open_gl.h"
|
||||
#include "flutter/flow/texture_image.h"
|
||||
|
||||
#include "flutter/flow/open_gl.h"
|
||||
#include "flutter/glue/trace_event.h"
|
||||
#include "third_party/skia/include/gpu/gl/GrGLTypes.h"
|
||||
|
||||
@@ -76,9 +77,8 @@ static sk_sp<SkImage> TextureImageCreate(GrContext* context,
|
||||
TRACE_EVENT2("flutter", __func__, "width", size.width(), "height",
|
||||
size.height());
|
||||
|
||||
if (context == nullptr) {
|
||||
if (!context)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GLuint handle = GL_NONE;
|
||||
|
||||
@@ -180,16 +180,6 @@ static sk_sp<SkImage> TextureImageCreate(GrContext* context,
|
||||
);
|
||||
}
|
||||
|
||||
sk_sp<SkImage> BitmapImageCreate(SkImageGenerator& generator) {
|
||||
SkBitmap bitmap;
|
||||
|
||||
if (generator.tryGenerateBitmap(&bitmap)) {
|
||||
return SkImage::MakeFromBitmap(bitmap);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkImage> TextureImageCreate(GrContext* context,
|
||||
SkImageGenerator& generator) {
|
||||
if (context == nullptr) {
|
||||
14
engine/src/flutter/flow/texture_image_none.cc
Normal file
14
engine/src/flutter/flow/texture_image_none.cc
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/flow/texture_image.h"
|
||||
|
||||
namespace flow {
|
||||
|
||||
sk_sp<SkImage> TextureImageCreate(GrContext* context,
|
||||
SkImageGenerator& generator) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace flow
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "flutter/lib/ui/painting/image_decoding.h"
|
||||
|
||||
#include "flutter/common/threads.h"
|
||||
#include "flutter/flow/bitmap_image.h"
|
||||
#include "flutter/flow/texture_image.h"
|
||||
#include "flutter/glue/drain_data_pipe_job.h"
|
||||
#include "flutter/glue/movable_wrapper.h"
|
||||
@@ -28,29 +29,24 @@ namespace {
|
||||
sk_sp<SkImage> DecodeImage(std::vector<char> buffer) {
|
||||
TRACE_EVENT0("blink", "DecodeImage");
|
||||
|
||||
if (buffer.empty()) {
|
||||
if (buffer.empty())
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkData> sk_data = SkData::MakeWithoutCopy(buffer.data(), buffer.size());
|
||||
|
||||
if (sk_data == nullptr) {
|
||||
if (sk_data == nullptr)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<SkImageGenerator> generator(
|
||||
SkImageGenerator::NewFromEncoded(sk_data.get()));
|
||||
|
||||
if (generator == nullptr) {
|
||||
if (generator == nullptr)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrContext* context = ResourceContext::Get();
|
||||
|
||||
// First, try to create a texture image from the generator.
|
||||
if (sk_sp<SkImage> image = flow::TextureImageCreate(context, *generator)) {
|
||||
GrContext* context = ResourceContext::Get();
|
||||
if (sk_sp<SkImage> image = flow::TextureImageCreate(context, *generator))
|
||||
return image;
|
||||
}
|
||||
|
||||
// The, as a fallback, try to create a regular Skia managed image. These
|
||||
// don't require a context ready.
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "flutter/runtime/dart_service_isolate.h"
|
||||
#include "flutter/runtime/start_up.h"
|
||||
#include "lib/ftl/arraysize.h"
|
||||
#include "lib/ftl/build_config.h"
|
||||
#include "lib/ftl/files/eintr_wrapper.h"
|
||||
#include "lib/ftl/files/unique_fd.h"
|
||||
#include "lib/ftl/logging.h"
|
||||
@@ -295,7 +296,7 @@ Dart_Isolate IsolateCreateCallback(const char* script_uri,
|
||||
}
|
||||
|
||||
Dart_Handle GetVMServiceAssetsArchiveCallback() {
|
||||
#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_RELEASE
|
||||
#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_RELEASE || defined(OS_FUCHSIA)
|
||||
return nullptr;
|
||||
#else // FLUTTER_RUNTIME_MODE
|
||||
return tonic::DartConverter<tonic::Uint8List>::ToDart(
|
||||
|
||||
Reference in New Issue
Block a user