forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Synchronize main thread and gpu thread for first render frame (flutte…
…r#9506) Got rid of the black frame by synchronizing the main thread with the gpu thread to make sure a frame is rendered before presenting the view.
- Loading branch information
Showing
6 changed files
with
239 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// 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. | ||
|
||
#ifndef FLUTTER_FML_STATUS_H_ | ||
#define FLUTTER_FML_STATUS_H_ | ||
|
||
#include <string_view> | ||
|
||
namespace fml { | ||
|
||
enum class StatusCode { | ||
kOk, | ||
kCancelled, | ||
kUnknown, | ||
kInvalidArgument, | ||
kDeadlineExceeded, | ||
kNotFound, | ||
kAlreadyExists, | ||
kPermissionDenied, | ||
kResourceExhausted, | ||
kFailedPrecondition, | ||
kAborted, | ||
kOutOfRange, | ||
kUnimplemented, | ||
kInternal, | ||
kUnavailable, | ||
kDataLoss, | ||
kUnauthenticated | ||
}; | ||
|
||
/// Class that represents the resolution of the execution of a procedure. This | ||
/// is used similarly to how exceptions might be used, typically as the return | ||
/// value to a synchronous procedure or an argument to an asynchronous callback. | ||
class Status final { | ||
public: | ||
/// Creates an 'ok' status. | ||
Status(); | ||
|
||
Status(fml::StatusCode code, std::string_view message); | ||
|
||
fml::StatusCode code() const; | ||
|
||
/// A noop that helps with static analysis tools if you decide to ignore an | ||
/// error. | ||
void IgnoreError() const; | ||
|
||
/// @return 'true' when the code is kOk. | ||
bool ok() const; | ||
|
||
std::string_view message() const; | ||
|
||
private: | ||
fml::StatusCode code_; | ||
std::string_view message_; | ||
}; | ||
|
||
inline Status::Status() : code_(fml::StatusCode::kOk), message_() {} | ||
|
||
inline Status::Status(fml::StatusCode code, std::string_view message) | ||
: code_(code), message_(message) {} | ||
|
||
inline fml::StatusCode Status::code() const { | ||
return code_; | ||
} | ||
|
||
inline void Status::IgnoreError() const { | ||
// noop | ||
} | ||
|
||
inline bool Status::ok() const { | ||
return code_ == fml::StatusCode::kOk; | ||
} | ||
|
||
inline std::string_view Status::message() const { | ||
return message_; | ||
} | ||
|
||
} // namespace fml | ||
|
||
#endif // FLUTTER_FML_SIZE_H_ |
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
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