forked from flutter/engine
-
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.
Finish removing //flutter/tonic (flutter#2917)
This pulled a refactoring of how we keep track of the primary threads.
- Loading branch information
Showing
41 changed files
with
261 additions
and
300 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,16 @@ | ||
# Copyright 2016 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
source_set("common") { | ||
sources = [ | ||
"settings.cc", | ||
"settings.h", | ||
"threads.cc", | ||
"threads.h", | ||
] | ||
|
||
deps = [ | ||
"//lib/ftl", | ||
] | ||
} |
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,5 @@ | ||
Flutter Common | ||
============== | ||
|
||
The bottom of the dependency graph for Flutter. Useful for static constants. | ||
Please don't put too much in here. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2016 The Chromium 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 "flutter/common/threads.h" | ||
|
||
#include <utility> | ||
|
||
namespace blink { | ||
namespace { | ||
|
||
Threads* g_threads = nullptr; | ||
|
||
} // namespace | ||
|
||
Threads::Threads() {} | ||
|
||
Threads::Threads(ftl::RefPtr<ftl::TaskRunner> gpu, | ||
ftl::RefPtr<ftl::TaskRunner> ui, | ||
ftl::RefPtr<ftl::TaskRunner> io) | ||
: gpu_(std::move(gpu)), ui_(std::move(ui)), io_(std::move(io)) {} | ||
|
||
Threads::~Threads() {} | ||
|
||
const ftl::RefPtr<ftl::TaskRunner>& Threads::Gpu() { | ||
return Get().gpu_; | ||
} | ||
|
||
const ftl::RefPtr<ftl::TaskRunner>& Threads::UI() { | ||
return Get().ui_; | ||
} | ||
|
||
const ftl::RefPtr<ftl::TaskRunner>& Threads::IO() { | ||
return Get().io_; | ||
} | ||
|
||
const Threads& Threads::Get() { | ||
FTL_CHECK(g_threads); | ||
return *g_threads; | ||
} | ||
|
||
void Threads::Set(const Threads& threads) { | ||
FTL_CHECK(!g_threads); | ||
g_threads = new Threads(); | ||
*g_threads = threads; | ||
} | ||
|
||
} // namespace blink |
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,36 @@ | ||
// Copyright 2016 The Chromium 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_COMMON_THREADS_H_ | ||
#define FLUTTER_COMMON_THREADS_H_ | ||
|
||
#include "lib/ftl/tasks/task_runner.h" | ||
|
||
namespace blink { | ||
|
||
class Threads { | ||
public: | ||
Threads(); | ||
Threads(ftl::RefPtr<ftl::TaskRunner> gpu, | ||
ftl::RefPtr<ftl::TaskRunner> ui, | ||
ftl::RefPtr<ftl::TaskRunner> io); | ||
~Threads(); | ||
|
||
static const ftl::RefPtr<ftl::TaskRunner>& Gpu(); | ||
static const ftl::RefPtr<ftl::TaskRunner>& UI(); | ||
static const ftl::RefPtr<ftl::TaskRunner>& IO(); | ||
|
||
static void Set(const Threads& settings); | ||
|
||
private: | ||
static const Threads& Get(); | ||
|
||
ftl::RefPtr<ftl::TaskRunner> gpu_; | ||
ftl::RefPtr<ftl::TaskRunner> ui_; | ||
ftl::RefPtr<ftl::TaskRunner> io_; | ||
}; | ||
|
||
} // namespace blink | ||
|
||
#endif // FLUTTER_COMMON_THREADS_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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,6 @@ source_set("jni") { | |
|
||
deps = [ | ||
"//base", | ||
"//flutter/tonic", | ||
"//lib/tonic", | ||
] | ||
} |
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
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
Oops, something went wrong.