Flutter Engine
The Flutter Engine
third_party
tonic
dart_message_handler.h
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef LIB_TONIC_DART_MESSAGE_HANDLER_H_
6
#define LIB_TONIC_DART_MESSAGE_HANDLER_H_
7
8
#include <functional>
9
10
#include "third_party/dart/runtime/include/dart_api.h"
11
#include "
tonic/logging/dart_error.h
"
12
13
namespace
tonic
{
14
class
DartState
;
15
16
class
DartMessageHandler
{
17
public
:
18
using
TaskDispatcher
=
std::function
<void(
std::function
<
void
(
void
)>)>;
19
20
DartMessageHandler
();
21
22
~DartMessageHandler
();
23
24
// Messages for the current isolate will be scheduled on |runner|.
25
void
Initialize
(
TaskDispatcher
dispatcher);
26
27
// Handle an unhandled error. If the error is fatal then shut down the
28
// isolate. The message handler's isolate must be the current isolate.
29
void
UnhandledError
(
Dart_Handle
error
);
30
31
// Did the isolate exit?
32
bool
isolate_exited
()
const
{
return
isolate_exited_
; }
33
34
// Did the isolate have an uncaught exception error?
35
bool
isolate_had_uncaught_exception_error
()
const
{
36
return
isolate_had_uncaught_exception_error_
;
37
}
38
39
DartErrorHandleType
isolate_last_error
()
const
{
return
isolate_last_error_
; }
40
41
protected
:
42
// Called from an unknown thread for each message.
43
void
OnMessage
(
DartState
* dart_state);
44
// By default, called on the task runner's thread for each message.
45
void
OnHandleMessage
(
DartState
* dart_state);
46
47
bool
handled_first_message
()
const
{
return
handled_first_message_
; }
48
49
void
set_handled_first_message
(
bool
handled_first_message
) {
50
handled_first_message_
=
handled_first_message
;
51
}
52
53
bool
handled_first_message_
;
54
bool
isolate_exited_
;
55
bool
isolate_had_uncaught_exception_error_
;
56
bool
isolate_had_fatal_error_
;
57
DartErrorHandleType
isolate_last_error_
;
58
TaskDispatcher
task_dispatcher_
;
59
60
private
:
61
static
void
MessageNotifyCallback(
Dart_Isolate
dest_isolate);
62
};
63
64
}
// namespace tonic
65
66
#endif
// LIB_TONIC_DART_MESSAGE_HANDLER_H_
tonic::DartMessageHandler
Definition:
dart_message_handler.h:16
tonic::DartMessageHandler::OnHandleMessage
void OnHandleMessage(DartState *dart_state)
Definition:
dart_message_handler.cc:63
tonic::DartMessageHandler::UnhandledError
void UnhandledError(Dart_Handle error)
Definition:
dart_message_handler.cc:47
tonic::DartMessageHandler::isolate_had_uncaught_exception_error_
bool isolate_had_uncaught_exception_error_
Definition:
dart_message_handler.h:55
tonic::DartMessageHandler::TaskDispatcher
std::function< void(std::function< void(void)>)> TaskDispatcher
Definition:
dart_message_handler.h:18
tonic::DartMessageHandler::isolate_had_fatal_error_
bool isolate_had_fatal_error_
Definition:
dart_message_handler.h:56
tonic::DartMessageHandler::OnMessage
void OnMessage(DartState *dart_state)
Definition:
dart_message_handler.cc:35
tonic::DartMessageHandler::isolate_had_uncaught_exception_error
bool isolate_had_uncaught_exception_error() const
Definition:
dart_message_handler.h:35
tonic::DartMessageHandler::isolate_exited_
bool isolate_exited_
Definition:
dart_message_handler.h:54
tonic::DartMessageHandler::isolate_last_error_
DartErrorHandleType isolate_last_error_
Definition:
dart_message_handler.h:57
tonic::DartMessageHandler::handled_first_message_
bool handled_first_message_
Definition:
dart_message_handler.h:53
tonic::DartMessageHandler::isolate_exited
bool isolate_exited() const
Definition:
dart_message_handler.h:32
tonic::DartMessageHandler::~DartMessageHandler
~DartMessageHandler()
Definition:
dart_message_handler.cc:24
tonic::DartMessageHandler::Initialize
void Initialize(TaskDispatcher dispatcher)
Definition:
dart_message_handler.cc:28
tonic::DartMessageHandler::task_dispatcher_
TaskDispatcher task_dispatcher_
Definition:
dart_message_handler.h:58
tonic::DartMessageHandler::DartMessageHandler
DartMessageHandler()
Definition:
dart_message_handler.cc:16
tonic::DartMessageHandler::set_handled_first_message
void set_handled_first_message(bool handled_first_message)
Definition:
dart_message_handler.h:49
tonic::DartMessageHandler::isolate_last_error
DartErrorHandleType isolate_last_error() const
Definition:
dart_message_handler.h:39
tonic::DartMessageHandler::handled_first_message
bool handled_first_message() const
Definition:
dart_message_handler.h:47
tonic::DartState
Definition:
dart_state.h:28
Dart_Handle
struct _Dart_Handle * Dart_Handle
Definition:
dart_api.h:258
Dart_Isolate
struct _Dart_Isolate * Dart_Isolate
Definition:
dart_api.h:88
dart_error.h
error
const uint8_t uint32_t uint32_t GError ** error
Definition:
fl_pixel_buffer_texture_test.cc:40
function
Dart_NativeFunction function
Definition:
fuchsia.cc:51
flutter::testing::DartState
FixtureTest DartState
Definition:
dart_state_unittest.cc:14
tonic
Definition:
image_filter.h:14
tonic::DartErrorHandleType
DartErrorHandleType
Definition:
dart_error.h:67
Generated on Sun Jun 23 2024 21:56:53 for Flutter Engine by
1.9.4