55
66#include " public/flutter_tizen.h"
77
8- #include < inttypes.h>
9- #include < unistd.h>
10-
118#include " flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h"
129#include " flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_message_codec.h"
1310#include " flutter/shell/platform/common/cpp/incoming_message_dispatcher.h"
@@ -21,62 +18,10 @@ struct FlutterWindowControllerState {
2118 std::unique_ptr<TizenEmbedderEngine> engine;
2219};
2320
24- // The pipe used for logging to dlog.
25- static int logging_pipe[2 ];
26- // The thread that constantly writes out stdout to dlog through the pipe.
27- // Only one logging thread should exist per process.
28- static pthread_t logging_thread;
29-
30- static void * LoggingFunction (void *) {
31- ssize_t size;
32- char buffer[1024 ];
33-
34- while ((size = read (logging_pipe[0 ], buffer, sizeof (buffer) - 1 )) > 0 ) {
35- buffer[size] = 0 ;
36- __dlog_print (LOG_ID_MAIN, DLOG_INFO, LOG_TAG, " %s" , buffer);
37- }
38-
39- close (logging_pipe[0 ]);
40- close (logging_pipe[1 ]);
41-
42- return nullptr ;
43- }
44-
45- // Redirects the process's standard output/error to dlog for use by the flutter
46- // tools.
47- bool InitializeLogging () {
48- if (logging_thread) {
49- FT_LOGD (" The logging thread already exists." );
50- return true ;
51- }
52-
53- if (pipe (logging_pipe) < 0 ) {
54- FT_LOGE (" Failed to create a pipe." );
55- return false ;
56- }
57-
58- if (dup2 (logging_pipe[1 ], 1 ) < 0 || dup2 (logging_pipe[1 ], 2 ) < 0 ) {
59- FT_LOGE (" Failed to duplicate file descriptors." );
60- return false ;
61- }
62-
63- if (pthread_create (&logging_thread, 0 , LoggingFunction, 0 ) != 0 ) {
64- FT_LOGE (" Failed to create a logging thread." );
65- logging_thread = 0 ;
66- return false ;
67- }
68-
69- if (pthread_detach (logging_thread) != 0 ) {
70- FT_LOGE (" Failed to detach the logging thread." );
71- return false ;
72- }
73- return true ;
74- }
75-
7621FlutterWindowControllerRef FlutterCreateWindow (
7722 const FlutterWindowProperties& window_properties,
7823 const FlutterEngineProperties& engine_properties) {
79- InitializeLogging ();
24+ StartLogging ();
8025
8126 auto state = std::make_unique<FlutterWindowControllerState>();
8227 state->engine = std::make_unique<TizenEmbedderEngine>(window_properties);
@@ -221,6 +166,7 @@ void FlutterNotifyLowMemoryWarning(FlutterWindowControllerRef controller) {
221166
222167void FlutterRotateWindow (FlutterWindowControllerRef controller,
223168 int32_t degree) {
169+ FT_LOGW (" Deprecated API. Use SystemChrome.setPreferredOrientations instead." );
224170}
225171
226172int64_t FlutterRegisterExternalTexture (
0 commit comments