Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
io_service_no_ssl.cc
Go to the documentation of this file.
1// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#if defined(DART_IO_SECURE_SOCKET_DISABLED)
6
8
9#include "bin/dartutils.h"
10#include "bin/directory.h"
11#include "bin/file.h"
12#include "bin/io_buffer.h"
13#include "bin/socket.h"
14#include "bin/utils.h"
15
16#include "include/dart_api.h"
17
18#include "platform/globals.h"
19#include "platform/utils.h"
20
21namespace dart {
22namespace bin {
23
24#define CASE_REQUEST(type, method, id) \
25 case IOService::k##type##method##Request: \
26 response = type::method##Request(data); \
27 break;
28
30 Dart_Port reply_port_id = ILLEGAL_PORT;
31 CObject* response = CObject::IllegalArgumentError();
32 CObjectArray request(message);
33 if ((message->type == Dart_CObject_kArray) && (request.Length() == 4) &&
34 request[0]->IsInt32() && request[1]->IsSendPort() &&
35 request[2]->IsInt32() && request[3]->IsArray()) {
36 CObjectInt32 message_id(request[0]);
37 CObjectSendPort reply_port(request[1]);
38 CObjectInt32 request_id(request[2]);
39 CObjectArray data(request[3]);
40 reply_port_id = reply_port.Value();
41 switch (request_id.Value()) {
43 default:
45 }
46 }
47
48 CObjectArray result(CObject::NewArray(2));
49 result.SetAt(0, request[0]);
50 result.SetAt(1, response);
51 ASSERT(reply_port_id != ILLEGAL_PORT);
52 Dart_PostCObject(reply_port_id, result.AsApiCObject());
53}
54
56 return Dart_NewNativePort("IOService", IOServiceCallback, true);
57}
58
61 Dart_Port service_port = IOService::GetServicePort();
62 if (service_port != ILLEGAL_PORT) {
63 // Return a send port for the service port.
64 Dart_Handle send_port = Dart_NewSendPort(service_port);
65 Dart_SetReturnValue(args, send_port);
66 }
67}
68
69} // namespace bin
70} // namespace dart
71
72#endif // defined(DART_IO_SECURE_SOCKET_DISABLED)
#define UNREACHABLE()
Definition assert.h:248
#define FUNCTION_NAME(name)
Definition builtin.h:19
static CObject * IllegalArgumentError()
static Dart_CObject * NewArray(intptr_t length)
Definition dartutils.cc:942
static Dart_Port GetServicePort()
Definition io_service.cc:57
#define ILLEGAL_PORT
Definition dart_api.h:1530
int64_t Dart_Port
Definition dart_api.h:1524
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
struct _Dart_NativeArguments * Dart_NativeArguments
Definition dart_api.h:3010
@ Dart_CObject_kArray
#define ASSERT(E)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
GAsyncResult * result
#define CASE_REQUEST(type, method, id)
Definition io_service.cc:26
#define IO_SERVICE_REQUEST_LIST(V)
Definition io_service.h:19
Win32Message message
void FUNCTION_NAME() IOService_NewServicePort(Dart_NativeArguments args)
Definition io_service.cc:61
void IOServiceCallback(Dart_Port dest_port_id, Dart_CObject *message)
Definition io_service.cc:31
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Dart_Handle retval)
DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id)
DART_EXPORT Dart_Port Dart_NewNativePort(const char *name, Dart_NativeMessageHandler handler, bool handle_concurrently)
DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject *message)
DART_EXPORT Dart_Handle Dart_Null()
static int8_t data[kExtLength]