Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: runtime/bin/io_service.cc

Issue 2480793002: clang-format runtime/bin (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/io_service.h ('k') | runtime/bin/io_service_no_ssl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #if !defined(DART_IO_DISABLED) && !defined(DART_IO_SECURE_SOCKET_DISABLED) 5 #if !defined(DART_IO_DISABLED) && !defined(DART_IO_SECURE_SOCKET_DISABLED)
6 6
7 #include "bin/io_service.h" 7 #include "bin/io_service.h"
8 8
9 #include "bin/dartutils.h" 9 #include "bin/dartutils.h"
10 #include "bin/directory.h" 10 #include "bin/directory.h"
11 #include "bin/file.h" 11 #include "bin/file.h"
12 #include "bin/io_buffer.h" 12 #include "bin/io_buffer.h"
13 #include "bin/secure_socket.h" 13 #include "bin/secure_socket.h"
14 #include "bin/socket.h" 14 #include "bin/socket.h"
15 #include "bin/utils.h" 15 #include "bin/utils.h"
16 16
17 #include "include/dart_api.h" 17 #include "include/dart_api.h"
18 18
19 #include "platform/globals.h" 19 #include "platform/globals.h"
20 #include "platform/utils.h" 20 #include "platform/utils.h"
21 21
22 namespace dart { 22 namespace dart {
23 namespace bin { 23 namespace bin {
24 24
25 #define CASE_REQUEST(type, method, id) \ 25 #define CASE_REQUEST(type, method, id) \
26 case IOService::k##type##method##Request: \ 26 case IOService::k##type##method##Request: \
27 response = type::method##Request(data); \ 27 response = type::method##Request(data); \
28 break; 28 break;
29 29
30 void IOServiceCallback(Dart_Port dest_port_id, 30 void IOServiceCallback(Dart_Port dest_port_id, Dart_CObject* message) {
31 Dart_CObject* message) {
32 Dart_Port reply_port_id = ILLEGAL_PORT; 31 Dart_Port reply_port_id = ILLEGAL_PORT;
33 CObject* response = CObject::IllegalArgumentError(); 32 CObject* response = CObject::IllegalArgumentError();
34 CObjectArray request(message); 33 CObjectArray request(message);
35 if ((message->type == Dart_CObject_kArray) && 34 if ((message->type == Dart_CObject_kArray) && (request.Length() == 4) &&
36 (request.Length() == 4) && 35 request[0]->IsInt32() && request[1]->IsSendPort() &&
37 request[0]->IsInt32() && 36 request[2]->IsInt32() && request[3]->IsArray()) {
38 request[1]->IsSendPort() &&
39 request[2]->IsInt32() &&
40 request[3]->IsArray()) {
41 CObjectInt32 message_id(request[0]); 37 CObjectInt32 message_id(request[0]);
42 CObjectSendPort reply_port(request[1]); 38 CObjectSendPort reply_port(request[1]);
43 CObjectInt32 request_id(request[2]); 39 CObjectInt32 request_id(request[2]);
44 CObjectArray data(request[3]); 40 CObjectArray data(request[3]);
45 reply_port_id = reply_port.Value(); 41 reply_port_id = reply_port.Value();
46 switch (request_id.Value()) { 42 switch (request_id.Value()) {
47 IO_SERVICE_REQUEST_LIST(CASE_REQUEST); 43 IO_SERVICE_REQUEST_LIST(CASE_REQUEST);
48 default: 44 default:
49 UNREACHABLE(); 45 UNREACHABLE();
50 } 46 }
51 } 47 }
52 48
53 CObjectArray result(CObject::NewArray(2)); 49 CObjectArray result(CObject::NewArray(2));
54 result.SetAt(0, request[0]); 50 result.SetAt(0, request[0]);
55 result.SetAt(1, response); 51 result.SetAt(1, response);
56 ASSERT(reply_port_id != ILLEGAL_PORT); 52 ASSERT(reply_port_id != ILLEGAL_PORT);
57 Dart_PostCObject(reply_port_id, result.AsApiCObject()); 53 Dart_PostCObject(reply_port_id, result.AsApiCObject());
(...skipping 13 matching lines...) Expand all
71 Dart_Handle send_port = Dart_NewSendPort(service_port); 67 Dart_Handle send_port = Dart_NewSendPort(service_port);
72 Dart_SetReturnValue(args, send_port); 68 Dart_SetReturnValue(args, send_port);
73 } 69 }
74 } 70 }
75 71
76 } // namespace bin 72 } // namespace bin
77 } // namespace dart 73 } // namespace dart
78 74
79 #endif // !defined(DART_IO_DISABLED) && 75 #endif // !defined(DART_IO_DISABLED) &&
80 // !defined(DART_IO_SECURE_SOCKET_DISABLED) 76 // !defined(DART_IO_SECURE_SOCKET_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/io_service.h ('k') | runtime/bin/io_service_no_ssl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698