mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
ceftests: Don't use base::Bind in object constructor (see issue #3140)
Fixes the following error: [FATAL:cef_bind_internal.h(868)] Check failed: receiver->HasAtLeastOneRef(). base::Bind{Once,Repeating}() refuses to create the first reference to ref-counted objects. That typically happens around PostTask() in their constructor, and such objects can be destroyed before `new` returns if the task resolves fast enough.
This commit is contained in:
@@ -495,11 +495,7 @@ class HttpTestRunner : public base::RefCountedThreadSafe<HttpTestRunner> {
|
||||
HttpTestRunner(bool parallel_requests)
|
||||
: parallel_requests_(parallel_requests),
|
||||
initialized_(false),
|
||||
next_request_id_(0) {
|
||||
handler_ = new TestServerHandler(
|
||||
base::Bind(&HttpTestRunner::OnServerStarted, this),
|
||||
base::Bind(&HttpTestRunner::OnServerDestroyed, this));
|
||||
}
|
||||
next_request_id_(0) {}
|
||||
|
||||
virtual ~HttpTestRunner() {
|
||||
if (destroy_event_)
|
||||
@@ -516,6 +512,10 @@ class HttpTestRunner : public base::RefCountedThreadSafe<HttpTestRunner> {
|
||||
void ExecuteTest() {
|
||||
EXPECT_FALSE(CefCurrentlyOn(TID_UI));
|
||||
|
||||
handler_ = new TestServerHandler(
|
||||
base::Bind(&HttpTestRunner::OnServerStarted, this),
|
||||
base::Bind(&HttpTestRunner::OnServerDestroyed, this));
|
||||
|
||||
run_event_ = CefWaitableEvent::CreateWaitableEvent(false, false);
|
||||
|
||||
CefPostTask(TID_UI, base::Bind(&HttpTestRunner::RunTest, this));
|
||||
|
Reference in New Issue
Block a user