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

Side by Side Diff: samples/myapi/generated/cc/myapi_service.cc

Issue 1209033003: Work in progres, please take a look and give early feedback if this is the way we want to structure… (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: address comments Created 5 years, 5 months 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 | « samples/myapi/generated/cc/myapi_service.h ('k') | samples/myapi/generated/cc/struct.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Fletch 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.md file.
4
5 // Generated file. Do not edit.
6
7 #include "myapi_service.h"
8 #include "include/service_api.h"
9 #include <stdlib.h>
10
11 static ServiceId service_id_ = kNoServiceId;
12
13 void MyApiService::setup() {
14 service_id_ = ServiceApiLookup("MyApiService");
15 }
16
17 void MyApiService::tearDown() {
18 ServiceApiTerminate(service_id_);
19 service_id_ = kNoServiceId;
20 }
21
22 static const MethodId kCreateId_ = reinterpret_cast<MethodId>(1);
23
24 int32_t MyApiService::create() {
25 static const int kSize = 64;
26 char _bits[kSize];
27 char* _buffer = _bits;
28 *reinterpret_cast<int64_t*>(_buffer + 48) = 0;
29 ServiceApiInvoke(service_id_, kCreateId_, _buffer, kSize);
30 return *reinterpret_cast<int64_t*>(_buffer + 56);
31 }
32
33 static void Unwrap_int32_8(void* raw) {
34 typedef void (*cbt)(int32_t, void*);
35 char* buffer = reinterpret_cast<char*>(raw);
36 int64_t result = *reinterpret_cast<int64_t*>(buffer + 56);
37 cbt callback = *reinterpret_cast<cbt*>(buffer + 40);
38 void* callback_data = *reinterpret_cast<void**>(buffer + 32);
39 MessageBuilder::DeleteMessage(buffer);
40 callback(result, callback_data);
41 }
42
43 void MyApiService::createAsync(void (*callback)(int32_t, void*), void* callback_ data) {
44 static const int kSize = 64 + 0 * sizeof(void*);
45 char* _buffer = reinterpret_cast<char*>(malloc(kSize));
46 *reinterpret_cast<int64_t*>(_buffer + 48) = 0;
47 *reinterpret_cast<void**>(_buffer + 40) = reinterpret_cast<void*>(callback);
48 *reinterpret_cast<void**>(_buffer + 32) = callback_data;
49 ServiceApiInvokeAsync(service_id_, kCreateId_, Unwrap_int32_8, _buffer, kSize) ;
50 }
51
52 static const MethodId kDestroyId_ = reinterpret_cast<MethodId>(2);
53
54 void MyApiService::destroy(int32_t api) {
55 static const int kSize = 64;
56 char _bits[kSize];
57 char* _buffer = _bits;
58 *reinterpret_cast<int64_t*>(_buffer + 48) = 0;
59 *reinterpret_cast<int32_t*>(_buffer + 56) = api;
60 ServiceApiInvoke(service_id_, kDestroyId_, _buffer, kSize);
61 }
62
63 static void Unwrap_void_8(void* raw) {
64 typedef void (*cbt)(void*);
65 char* buffer = reinterpret_cast<char*>(raw);
66 cbt callback = *reinterpret_cast<cbt*>(buffer + 40);
67 void* callback_data = *reinterpret_cast<void**>(buffer + 32);
68 MessageBuilder::DeleteMessage(buffer);
69 callback(callback_data);
70 }
71
72 void MyApiService::destroyAsync(int32_t api, void (*callback)(void*), void* call back_data) {
73 static const int kSize = 64 + 0 * sizeof(void*);
74 char* _buffer = reinterpret_cast<char*>(malloc(kSize));
75 *reinterpret_cast<int64_t*>(_buffer + 48) = 0;
76 *reinterpret_cast<int32_t*>(_buffer + 56) = api;
77 *reinterpret_cast<void**>(_buffer + 40) = reinterpret_cast<void*>(callback);
78 *reinterpret_cast<void**>(_buffer + 32) = callback_data;
79 ServiceApiInvokeAsync(service_id_, kDestroyId_, Unwrap_void_8, _buffer, kSize) ;
80 }
81
82 static const MethodId kFooId_ = reinterpret_cast<MethodId>(3);
83
84 int32_t MyApiService::foo(int32_t api) {
85 static const int kSize = 64;
86 char _bits[kSize];
87 char* _buffer = _bits;
88 *reinterpret_cast<int64_t*>(_buffer + 48) = 0;
89 *reinterpret_cast<int32_t*>(_buffer + 56) = api;
90 ServiceApiInvoke(service_id_, kFooId_, _buffer, kSize);
91 return *reinterpret_cast<int64_t*>(_buffer + 56);
92 }
93
94 void MyApiService::fooAsync(int32_t api, void (*callback)(int32_t, void*), void* callback_data) {
95 static const int kSize = 64 + 0 * sizeof(void*);
96 char* _buffer = reinterpret_cast<char*>(malloc(kSize));
97 *reinterpret_cast<int64_t*>(_buffer + 48) = 0;
98 *reinterpret_cast<int32_t*>(_buffer + 56) = api;
99 *reinterpret_cast<void**>(_buffer + 40) = reinterpret_cast<void*>(callback);
100 *reinterpret_cast<void**>(_buffer + 32) = callback_data;
101 ServiceApiInvokeAsync(service_id_, kFooId_, Unwrap_int32_8, _buffer, kSize);
102 }
103
104 static const MethodId kMyObjectFunkId_ = reinterpret_cast<MethodId>(4);
105
106 void MyApiService::MyObject_funk(int32_t api, int32_t id, int32_t o) {
107 static const int kSize = 72;
108 char _bits[kSize];
109 char* _buffer = _bits;
110 *reinterpret_cast<int64_t*>(_buffer + 48) = 0;
111 *reinterpret_cast<int32_t*>(_buffer + 56) = api;
112 *reinterpret_cast<int32_t*>(_buffer + 60) = id;
113 *reinterpret_cast<int32_t*>(_buffer + 64) = o;
114 ServiceApiInvoke(service_id_, kMyObjectFunkId_, _buffer, kSize);
115 }
116
117 static void Unwrap_void_16(void* raw) {
118 typedef void (*cbt)(void*);
119 char* buffer = reinterpret_cast<char*>(raw);
120 cbt callback = *reinterpret_cast<cbt*>(buffer + 40);
121 void* callback_data = *reinterpret_cast<void**>(buffer + 32);
122 MessageBuilder::DeleteMessage(buffer);
123 callback(callback_data);
124 }
125
126 void MyApiService::MyObject_funkAsync(int32_t api, int32_t id, int32_t o, void ( *callback)(void*), void* callback_data) {
127 static const int kSize = 72 + 0 * sizeof(void*);
128 char* _buffer = reinterpret_cast<char*>(malloc(kSize));
129 *reinterpret_cast<int64_t*>(_buffer + 48) = 0;
130 *reinterpret_cast<int32_t*>(_buffer + 56) = api;
131 *reinterpret_cast<int32_t*>(_buffer + 60) = id;
132 *reinterpret_cast<int32_t*>(_buffer + 64) = o;
133 *reinterpret_cast<void**>(_buffer + 40) = reinterpret_cast<void*>(callback);
134 *reinterpret_cast<void**>(_buffer + 32) = callback_data;
135 ServiceApiInvokeAsync(service_id_, kMyObjectFunkId_, Unwrap_void_16, _buffer, kSize);
136 }
OLDNEW
« no previous file with comments | « samples/myapi/generated/cc/myapi_service.h ('k') | samples/myapi/generated/cc/struct.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698