Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 66c8e30

Browse files
committed
Initial compiling impl of full android path
1 parent 743cc8e commit 66c8e30

File tree

13 files changed

+64
-15
lines changed

13 files changed

+64
-15
lines changed

lib/ui/window/window.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class WindowClient {
5959
int64_t isolate_port) = 0;
6060
virtual void SetNeedsReportTimings(bool value) = 0;
6161
virtual std::shared_ptr<const fml::Mapping> GetPersistentIsolateData() = 0;
62-
virtual std::vector<std::string> ComputePlatformResolvedLocale(
62+
virtual std::vector<std::string>& ComputePlatformResolvedLocale(
6363
const std::vector<std::string>& supportedLocaleData) = 0;
6464

6565
protected:

runtime/runtime_controller.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,10 @@ RuntimeController::GetPersistentIsolateData() {
341341
}
342342

343343
// |WindowClient|
344-
std::vector<std::string> RuntimeController::ComputePlatformResolvedLocale(
344+
std::vector<std::string>& RuntimeController::ComputePlatformResolvedLocale(
345345
const std::vector<std::string>& supportedLocaleData) {
346-
return std::vector<std::string>();
346+
return client_.ComputePlatformResolvedLocale(supportedLocaleData);
347+
// return std::vector<std::string>();
347348
}
348349

349350
Dart_Port RuntimeController::GetMainPort() {

runtime/runtime_controller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ class RuntimeController final : public WindowClient {
523523
std::shared_ptr<const fml::Mapping> GetPersistentIsolateData() override;
524524

525525
// |WindowClient|
526-
std::vector<std::string> ComputePlatformResolvedLocale(
526+
std::vector<std::string>& ComputePlatformResolvedLocale(
527527
const std::vector<std::string>& supportedLocaleData) override;
528528

529529
FML_DISALLOW_COPY_AND_ASSIGN(RuntimeController);

runtime/runtime_delegate.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class RuntimeDelegate {
3737

3838
virtual void SetNeedsReportTimings(bool value) = 0;
3939

40+
virtual std::vector<std::string>& ComputePlatformResolvedLocale(
41+
const std::vector<std::string>& supportedLocaleData) = 0;
42+
4043
protected:
4144
virtual ~RuntimeDelegate();
4245
};

shell/common/engine.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,11 @@ void Engine::UpdateIsolateDescription(const std::string isolate_name,
487487
delegate_.UpdateIsolateDescription(isolate_name, isolate_port);
488488
}
489489

490+
std::vector<std::string>& Engine::ComputePlatformResolvedLocale(
491+
const std::vector<std::string>& supportedLocaleData) {
492+
return delegate_.ComputePlatformResolvedLocale(supportedLocaleData);
493+
}
494+
490495
void Engine::SetNeedsReportTimings(bool needs_reporting) {
491496
delegate_.SetNeedsReportTimings(needs_reporting);
492497
}

shell/common/engine.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
227227
/// collected and send back to Dart.
228228
///
229229
virtual void SetNeedsReportTimings(bool needs_reporting) = 0;
230+
231+
virtual std::vector<std::string>& ComputePlatformResolvedLocale(
232+
const std::vector<std::string>& supportedLocaleData) = 0;
230233
};
231234

232235
//----------------------------------------------------------------------------
@@ -767,6 +770,10 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
767770
void UpdateIsolateDescription(const std::string isolate_name,
768771
int64_t isolate_port) override;
769772

773+
// |RuntimeDelegate|
774+
std::vector<std::string>& ComputePlatformResolvedLocale(
775+
const std::vector<std::string>& supportedLocaleData) override;
776+
770777
void SetNeedsReportTimings(bool value) override;
771778

772779
void StopAnimator();

shell/common/platform_view.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ void PlatformView::SetNextFrameCallback(const fml::closure& closure) {
137137
delegate_.OnPlatformViewSetNextFrameCallback(closure);
138138
}
139139

140-
std::vector<std::string> PlatformView::ComputePlatformResolvedLocales(
141-
std::vector<std::string> supportedLocaleData) {
142-
return std::vector<std::string>();
140+
std::vector<std::string>& PlatformView::ComputePlatformResolvedLocales(
141+
const std::vector<std::string>& supportedLocaleData) {
142+
// std::vector<std::string> result = std::vector<std::string>();
143+
// *result = std::vector<std::string>();
144+
return delegate_.ComputePlatformViewResolvedLocale(supportedLocaleData);
143145
}
144146

145147
} // namespace flutter

shell/common/platform_view.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ class PlatformView {
209209
///
210210
virtual void OnPlatformViewMarkTextureFrameAvailable(
211211
int64_t texture_id) = 0;
212+
213+
virtual std::vector<std::string>& ComputePlatformViewResolvedLocale(
214+
const std::vector<std::string>& supportedLocaleData) = 0;
212215
};
213216

214217
//----------------------------------------------------------------------------
@@ -543,8 +546,8 @@ class PlatformView {
543546
///
544547
void MarkTextureFrameAvailable(int64_t texture_id);
545548

546-
virtual std::vector<std::string> ComputePlatformResolvedLocales(
547-
std::vector<std::string> supportedLocaleData);
549+
virtual std::vector<std::string>& ComputePlatformResolvedLocales(
550+
const std::vector<std::string>& supportedLocaleData);
548551

549552
protected:
550553
PlatformView::Delegate& delegate_;

shell/common/shell.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,18 @@ void Shell::SetNeedsReportTimings(bool value) {
10901090
needs_report_timings_ = value;
10911091
}
10921092

1093+
// |Engine::Delegate|
1094+
std::vector<std::string>& Shell::ComputePlatformResolvedLocale(
1095+
const std::vector<std::string>& supportedLocaleData) {
1096+
return ComputePlatformViewResolvedLocale(supportedLocaleData);
1097+
}
1098+
1099+
// |PlatformView::Delegate|
1100+
std::vector<std::string>& Shell::ComputePlatformViewResolvedLocale(
1101+
const std::vector<std::string>& supportedLocaleData) {
1102+
return platform_view_->ComputePlatformResolvedLocales(supportedLocaleData);
1103+
}
1104+
10931105
void Shell::ReportTimings() {
10941106
FML_DCHECK(is_setup_);
10951107
FML_DCHECK(task_runners_.GetRasterTaskRunner()->RunsTasksOnCurrentThread());

shell/common/shell.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@ class Shell final : public PlatformView::Delegate,
482482
// |PlatformView::Delegate|
483483
void OnPlatformViewSetNextFrameCallback(const fml::closure& closure) override;
484484

485+
// |PlatformView::Delegate|
486+
std::vector<std::string>& ComputePlatformViewResolvedLocale(
487+
const std::vector<std::string>& supportedLocaleData) override;
488+
485489
// |Animator::Delegate|
486490
void OnAnimatorBeginFrame(fml::TimePoint frame_target_time) override;
487491

@@ -516,6 +520,10 @@ class Shell final : public PlatformView::Delegate,
516520
// |Engine::Delegate|
517521
void SetNeedsReportTimings(bool value) override;
518522

523+
// |Engine::Delegate|
524+
std::vector<std::string>& ComputePlatformResolvedLocale(
525+
const std::vector<std::string>& supportedLocaleData) override;
526+
519527
// |Rasterizer::Delegate|
520528
void OnFrameRasterized(const FrameTiming&) override;
521529

shell/platform/android/platform_view_android.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,17 +426,20 @@ void PlatformViewAndroid::ReleaseResourceContext() const {
426426
}
427427
}
428428

429-
std::vector<std::string> PlatformViewAndroid::ComputePlatformResolvedLocales(
430-
std::vector<std::string> supportedLocaleData) {
429+
// |PlatformView|
430+
std::vector<std::string>& PlatformViewAndroid::ComputePlatformResolvedLocales(
431+
const std::vector<std::string>& supportedLocaleData) {
431432
JNIEnv* env = fml::jni::AttachCurrentThread();
432433
fml::jni::ScopedJavaLocalRef<jobject> view = java_object_.get(env);
433434
if (view.is_null()) {
434435
// The Java object died.
435-
return std::vector<std::string>();
436+
*platform_resolved_locale_ = std::vector<std::string>();
437+
return *platform_resolved_locale_;
436438
}
437-
return FlutterViewComputePlatformResolvedLocale(
439+
*platform_resolved_locale_ = FlutterViewComputePlatformResolvedLocale(
438440
env, view.obj(),
439441
fml::jni::VectorToStringArray(env, supportedLocaleData).obj());
442+
return *platform_resolved_locale_;
440443
}
441444

442445
void PlatformViewAndroid::InstallFirstFrameCallback() {

shell/platform/android/platform_view_android.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class PlatformViewAndroid final : public PlatformView {
8080
int next_response_id_ = 1;
8181
std::unordered_map<int, fml::RefPtr<flutter::PlatformMessageResponse>>
8282
pending_responses_;
83+
std::vector<std::string>* platform_resolved_locale_;
8384

8485
// |PlatformView|
8586
void UpdateSemantics(
@@ -106,8 +107,8 @@ class PlatformViewAndroid final : public PlatformView {
106107
void ReleaseResourceContext() const override;
107108

108109
// |PlatformView|
109-
std::vector<std::string> ComputePlatformResolvedLocales(
110-
std::vector<std::string> supportedLocaleData) override;
110+
std::vector<std::string>& ComputePlatformResolvedLocales(
111+
const std::vector<std::string>& supportedLocaleData) override;
111112

112113
void InstallFirstFrameCallback();
113114

shell/platform/darwin/ios/platform_view_ios.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ class PlatformViewIOS final : public PlatformView {
152152
// |PlatformView|
153153
void OnPreEngineRestart() const override;
154154

155+
// |PlatformView|
156+
std::vector<std::string>& ComputePlatformResolvedLocales(
157+
const std::vector<std::string>& supportedLocaleData) override;
158+
155159
FML_DISALLOW_COPY_AND_ASSIGN(PlatformViewIOS);
156160
};
157161

0 commit comments

Comments
 (0)