[fml] Remove unused ResourceMapping code. (flutter/engine#5811)
ResourceMapping-related code is no longer used.Moreover, there is an ASan related-error in ResourceMappingDarwin: https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket.appspot.com/8940466063445826656/+/steps/test_results/0/steps/s___out_release-x64_host_tests_dart_schema_tests/0/logs/stdio/0
This commit is contained in:
@@ -77,8 +77,6 @@ source_set("fml") {
|
||||
"platform/darwin/paths_darwin.mm",
|
||||
"platform/darwin/platform_version.h",
|
||||
"platform/darwin/platform_version.mm",
|
||||
"platform/darwin/resource_mapping_darwin.h",
|
||||
"platform/darwin/resource_mapping_darwin.mm",
|
||||
"platform/darwin/scoped_block.h",
|
||||
"platform/darwin/scoped_block.mm",
|
||||
"platform/darwin/scoped_nsobject.h",
|
||||
|
||||
@@ -38,15 +38,6 @@ class ICUContext {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check to see if the mapping is in the resources bundle.
|
||||
if (PlatformHasResourcesBundle()) {
|
||||
auto resource = GetResourceMapping(icu_data_path);
|
||||
if (resource != nullptr && resource->GetSize() != 0) {
|
||||
mapping_ = std::move(resource);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the mapping can by directly accessed via a file path. In this
|
||||
// case, the data file needs to be next to the executable.
|
||||
auto directory = fml::paths::GetExecutableDirectoryPath();
|
||||
|
||||
@@ -29,10 +29,6 @@ class Mapping {
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(Mapping);
|
||||
};
|
||||
|
||||
bool PlatformHasResourcesBundle();
|
||||
|
||||
std::unique_ptr<Mapping> GetResourceMapping(const std::string& resource_name);
|
||||
|
||||
class FileMapping : public Mapping {
|
||||
public:
|
||||
FileMapping(const std::string& path, bool executable = false);
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
// Copyright 2017 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_FML_PLATFORM_DARWIN_RESOURCE_MAPPING_DARWIN_H_
|
||||
#define FLUTTER_FML_PLATFORM_DARWIN_RESOURCE_MAPPING_DARWIN_H_
|
||||
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/fml/mapping.h"
|
||||
|
||||
namespace fml {
|
||||
|
||||
class ResourceMappingDarwin : public Mapping {
|
||||
public:
|
||||
ResourceMappingDarwin(const std::string& resource);
|
||||
|
||||
~ResourceMappingDarwin() override;
|
||||
|
||||
size_t GetSize() const override;
|
||||
|
||||
const uint8_t* GetMapping() const override;
|
||||
|
||||
private:
|
||||
FileMapping actual_;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(ResourceMappingDarwin);
|
||||
};
|
||||
|
||||
} // namespace fml
|
||||
|
||||
#endif // FLUTTER_FML_PLATFORM_DARWIN_RESOURCE_MAPPING_DARWIN_H_
|
||||
@@ -1,25 +0,0 @@
|
||||
// Copyright 2017 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/fml/platform/darwin/resource_mapping_darwin.h"
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
namespace fml {
|
||||
|
||||
ResourceMappingDarwin::ResourceMappingDarwin(const std::string& resource)
|
||||
: actual_([[[NSBundle mainBundle] pathForResource:@(resource.c_str()) ofType:nil] UTF8String],
|
||||
false) {}
|
||||
|
||||
ResourceMappingDarwin::~ResourceMappingDarwin() = default;
|
||||
|
||||
size_t ResourceMappingDarwin::GetSize() const {
|
||||
return actual_.GetSize();
|
||||
}
|
||||
|
||||
const uint8_t* ResourceMappingDarwin::GetMapping() const {
|
||||
return actual_.GetMapping();
|
||||
}
|
||||
|
||||
} // namespace fml
|
||||
@@ -15,31 +15,12 @@
|
||||
#include "flutter/fml/eintr_wrapper.h"
|
||||
#include "flutter/fml/unique_fd.h"
|
||||
|
||||
#if OS_MACOSX
|
||||
|
||||
#include "flutter/fml/platform/darwin/resource_mapping_darwin.h"
|
||||
using PlatformResourceMapping = fml::ResourceMappingDarwin;
|
||||
|
||||
#else
|
||||
|
||||
using PlatformResourceMapping = fml::FileMapping;
|
||||
|
||||
#endif
|
||||
|
||||
namespace fml {
|
||||
|
||||
Mapping::Mapping() = default;
|
||||
|
||||
Mapping::~Mapping() = default;
|
||||
|
||||
bool PlatformHasResourcesBundle() {
|
||||
return !std::is_same<PlatformResourceMapping, FileMapping>::value;
|
||||
}
|
||||
|
||||
std::unique_ptr<Mapping> GetResourceMapping(const std::string& resource_name) {
|
||||
return std::make_unique<PlatformResourceMapping>(resource_name);
|
||||
}
|
||||
|
||||
FileMapping::FileMapping(const std::string& path, bool executable)
|
||||
: FileMapping(
|
||||
fml::UniqueFD{FML_HANDLE_EINTR(::open(path.c_str(), O_RDONLY))},
|
||||
|
||||
@@ -13,22 +13,12 @@
|
||||
#include "flutter/fml/file.h"
|
||||
#include "flutter/fml/platform/win/wstring_conversion.h"
|
||||
|
||||
using PlatformResourceMapping = fml::FileMapping;
|
||||
|
||||
namespace fml {
|
||||
|
||||
Mapping::Mapping() = default;
|
||||
|
||||
Mapping::~Mapping() = default;
|
||||
|
||||
bool PlatformHasResourcesBundle() {
|
||||
return !std::is_same<PlatformResourceMapping, FileMapping>::value;
|
||||
}
|
||||
|
||||
std::unique_ptr<Mapping> GetResourceMapping(const std::string& resource_name) {
|
||||
return std::make_unique<PlatformResourceMapping>(resource_name);
|
||||
}
|
||||
|
||||
FileMapping::FileMapping(const std::string& path, bool executable)
|
||||
: FileMapping(OpenFile(path.c_str(),
|
||||
executable ? OpenPermission::kExecute
|
||||
|
||||
Reference in New Issue
Block a user