Skip to content

Commit 51e583b

Browse files
authored
Revert "Remove tonic/platform. (flutter-team-archive#16062)"
This reverts commit 165412a.
1 parent e755913 commit 51e583b

8 files changed

Lines changed: 75 additions & 0 deletions

File tree

ci/licenses_golden/licenses_flutter

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,9 @@ FILE: ../../../flutter/third_party/tonic/logging/dart_invoke.cc
11681168
FILE: ../../../flutter/third_party/tonic/logging/dart_invoke.h
11691169
FILE: ../../../flutter/third_party/tonic/parsers/packages_map.cc
11701170
FILE: ../../../flutter/third_party/tonic/parsers/packages_map.h
1171+
FILE: ../../../flutter/third_party/tonic/platform/platform_utils.h
1172+
FILE: ../../../flutter/third_party/tonic/platform/platform_utils_posix.cc
1173+
FILE: ../../../flutter/third_party/tonic/platform/platform_utils_win.cc
11711174
FILE: ../../../flutter/third_party/tonic/scopes/dart_api_scope.h
11721175
FILE: ../../../flutter/third_party/tonic/scopes/dart_isolate_scope.cc
11731176
FILE: ../../../flutter/third_party/tonic/scopes/dart_isolate_scope.h

third_party/tonic/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ source_set("tonic") {
3939
"converter",
4040
"file_loader",
4141
"logging",
42+
"platform",
4243
"scopes",
4344
"typed_data",
4445
"//third_party/dart/runtime:dart_api",

third_party/tonic/file_loader/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ source_set("file_loader") {
2525
"../converter",
2626
"../filesystem",
2727
"../parsers",
28+
"../platform",
2829
"//third_party/dart/runtime:dart_api",
2930
]
3031
}

third_party/tonic/file_loader/file_loader.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "tonic/common/macros.h"
1515
#include "tonic/converter/dart_converter.h"
1616
#include "tonic/parsers/packages_map.h"
17+
#include "tonic/platform/platform_utils.h"
1718

1819
namespace tonic {
1920
namespace {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2013 The Flutter Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
source_set("platform") {
6+
visibility = [ "../*" ]
7+
8+
configs += [ "../:config" ]
9+
10+
if (is_win) {
11+
set_sources_assignment_filter([ "*_posix.cc" ])
12+
} else {
13+
set_sources_assignment_filter([ "*_win.cc" ])
14+
}
15+
16+
deps = [
17+
"../common",
18+
]
19+
20+
sources = [
21+
"platform_utils.h",
22+
"platform_utils_posix.cc",
23+
"platform_utils_win.cc",
24+
]
25+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#ifndef LIB_TONIC_PLATFORM_UTILS_H_
6+
#define LIB_TONIC_PLATFORM_UTILS_H_
7+
8+
namespace tonic {
9+
10+
// Calls the equivalent of exit(status) for a given platform.
11+
void PlatformExit(int status);
12+
13+
} // namespace tonic
14+
15+
#endif // LIB_TONIC_PLATFORM_UTILS_H_
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include <cstdlib>
6+
#include "platform_utils.h"
7+
8+
namespace tonic {
9+
10+
void PlatformExit(int status) {
11+
exit(status);
12+
}
13+
14+
} // namespace tonic
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "platform_utils.h"
6+
7+
#include <windows.h>
8+
9+
namespace tonic {
10+
11+
void PlatformExit(int status) {
12+
::ExitProcess(status);
13+
}
14+
15+
} // namespace tonic

0 commit comments

Comments
 (0)