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

Side by Side Diff: runtime/bin/native_service.h

Issue 12328037: Add missing files from previous commit (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/native_service.cc » ('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) 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 #ifndef BIN_NATIVE_SERVICE_H_
6 #define BIN_NATIVE_SERVICE_H_
7
8 #include "include/dart_api.h"
9 #include "platform/globals.h"
10 #include "platform/thread.h"
11
12 // Utility class to set up a native service and allocate Dart native
13 // ports to interact with it from Dart code. The number of native ports
14 // allocated for each service is limited.
15 class NativeService {
16 public:
17 // Create a native service with the given name and handler. Allow
18 // the creation of [number_of_ports] native ports for the service.
19 // If GetServicePort is called more than [number_of_ports] times
20 // one of the already allocated native ports will be reused.
21 NativeService(const char* name,
22 Dart_NativeMessageHandler handler,
23 int number_of_ports);
24
25 ~NativeService();
26
27 // Get a Dart native port for this native service.
28 Dart_Port GetServicePort();
29
30 private:
31 // Name and handler for the native service.
32 const char* name_;
33 Dart_NativeMessageHandler handler_;
34
35 // Allocated native ports for the service. Mutex protected since
36 // the service can be used from multiple isolates.
37 dart::Mutex mutex_;
38 int service_ports_size_;
39 Dart_Port* service_ports_;
40 int service_ports_index_;
41
42 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeService);
43 };
44
45 #endif // BIN_NATIVE_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/native_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698