Revert "Added assert for opengles thread safety (#56585)" (flutter/engine#56730)
This reverts commit 11123f1bbf.
The implementation of the assert assumes that there is a single raster thread ID that will remain constant throughout the lifetime of the process. That is not true for scenarios like recreating the engine after suspending and resuming an Android app, or instantiating multiple engines within one process.
This commit is contained in:
@@ -144,10 +144,6 @@ ProcTableGLES::ProcTableGLES( // NOLINT(google-readability-function-size)
|
||||
|
||||
capabilities_ = std::make_shared<CapabilitiesGLES>(*this);
|
||||
|
||||
// This this will force glUseProgram to only be used on one thread in debug
|
||||
// builds to identify threading violations in the engine.
|
||||
UseProgram.enforce_one_thread = true;
|
||||
|
||||
is_valid_ = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
#define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PROC_TABLE_GLES_H_
|
||||
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "flutter/fml/mapping.h"
|
||||
@@ -101,14 +99,6 @@ struct GLProc {
|
||||
///
|
||||
bool log_calls = false;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// Whether the OpenGL call asserts it is only used from / one thread in
|
||||
/// IMPELLER_DEBUG builds.
|
||||
///
|
||||
/// This is used to block drawing calls from happening anywhere but the raster
|
||||
/// thread.
|
||||
bool enforce_one_thread = false;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// @brief Call the GL function with the appropriate parameters. Lookup
|
||||
/// the documentation for the GL function being called to
|
||||
@@ -128,16 +118,6 @@ struct GLProc {
|
||||
FML_LOG(IMPORTANT) << name
|
||||
<< BuildGLArguments(std::forward<Args>(args)...);
|
||||
}
|
||||
if (enforce_one_thread) {
|
||||
static std::thread::id allowed_thread;
|
||||
static std::once_flag flag;
|
||||
std::call_once(flag,
|
||||
[]() { allowed_thread = std::this_thread::get_id(); });
|
||||
FML_CHECK(std::this_thread::get_id() == allowed_thread)
|
||||
<< "This symbol is expected to be called from one thread, the raster "
|
||||
"thread. As of this addition, the design of the engine should be "
|
||||
"using non-raster threads only for uploading images.";
|
||||
}
|
||||
#endif // defined(IMPELLER_DEBUG) && !defined(NDEBUG)
|
||||
return function(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user