-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: swan.seo <[email protected]>
- Loading branch information
Showing
11 changed files
with
263 additions
and
25 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
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
40 changes: 40 additions & 0 deletions
40
flutter/shell/platform/tizen/flutter_tizen_engine_group.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,40 @@ | ||
#include "flutter/shell/platform/tizen/flutter_tizen_engine_group.h" | ||
|
||
#include <random> | ||
|
||
namespace flutter { | ||
|
||
FlutterTizenEngine* FlutterTizenEngineGroup::MakeEngineWithProject( | ||
const FlutterProjectBundle& project) { | ||
std::unique_ptr<FlutterTizenEngine> engine = | ||
std::make_unique<flutter::FlutterTizenEngine>(project); | ||
|
||
static std::random_device random_device; | ||
static std::mt19937 generator(random_device()); | ||
static std::uniform_int_distribution<uint32_t> distribution(0, 99999); | ||
|
||
engine->SetId(distribution(generator)); | ||
|
||
engines_.push_back(std::move(engine)); | ||
return engines_.back().get(); | ||
} | ||
|
||
FlutterTizenEngine* FlutterTizenEngineGroup::GetEngineSpawner() { | ||
return engines_[0].get(); | ||
} | ||
|
||
int FlutterTizenEngineGroup::GetEngineCount() { | ||
return engines_.size(); | ||
} | ||
|
||
void FlutterTizenEngineGroup::StopEngine(uint32_t id) { | ||
for (auto it = engines_.begin(); it != engines_.end(); ++it) { | ||
if (id == it->get()->id()) { | ||
it->get()->StopEngine(); | ||
engines_.erase(it); | ||
return; | ||
} | ||
} | ||
} | ||
|
||
} // namespace flutter |
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,32 @@ | ||
#ifndef EMBEDDER_FLUTTER_TIZEN_ENGINE_GROUP_H_ | ||
#define EMBEDDER_FLUTTER_TIZEN_ENGINE_GROUP_H_ | ||
|
||
#include "flutter/shell/platform/tizen/flutter_tizen_engine.h" | ||
|
||
namespace flutter { | ||
|
||
class FlutterTizenEngineGroup { | ||
public: | ||
static FlutterTizenEngineGroup& GetInstance() { | ||
static FlutterTizenEngineGroup instance; | ||
return instance; | ||
} | ||
|
||
FlutterTizenEngine* GetEngineSpawner(); | ||
|
||
FlutterTizenEngine* MakeEngineWithProject( | ||
const FlutterProjectBundle& project); | ||
|
||
int GetEngineCount(); | ||
|
||
void StopEngine(uint32_t id); | ||
|
||
private: | ||
FlutterTizenEngineGroup() {} | ||
|
||
std::vector<std::unique_ptr<FlutterTizenEngine>> engines_; | ||
}; | ||
|
||
} // namespace flutter | ||
|
||
#endif |
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.