-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
shell/platform/darwin/common/availability_version_check.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2013 The Flutter 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 <dispatch/dispatch.h> | ||
#include <dlfcn.h> | ||
#include <cstdint> | ||
|
||
#include "flutter/fml/logging.h" | ||
|
||
namespace { | ||
|
||
typedef uint32_t dyld_platform_t; | ||
|
||
typedef struct { | ||
dyld_platform_t platform; | ||
uint32_t version; | ||
} dyld_build_version_t; | ||
|
||
typedef bool (*AvailabilityVersionCheckFn)(uint32_t count, | ||
dyld_build_version_t versions[]); | ||
|
||
AvailabilityVersionCheckFn AvailabilityVersionCheck; | ||
|
||
dispatch_once_t DispatchOnceCounter; | ||
|
||
void InitializeAvailabilityCheck(void* unused) { | ||
if (AvailabilityVersionCheck) { | ||
return; | ||
} | ||
AvailabilityVersionCheck = reinterpret_cast<AvailabilityVersionCheckFn>( | ||
dlsym(RTLD_DEFAULT, "_availability_version_check")); | ||
FML_CHECK(AvailabilityVersionCheck); | ||
} | ||
|
||
extern "C" bool _availability_version_check(uint32_t count, | ||
dyld_build_version_t versions[]) { | ||
dispatch_once_f(&DispatchOnceCounter, NULL, InitializeAvailabilityCheck); | ||
return AvailabilityVersionCheck(count, versions); | ||
} | ||
|
||
} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters