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

Side by Side Diff: tools/servicec/lib/src/resources/java/dartino/BuilderSegment.java

Issue 2035023003: Remove service-compiler related code. (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dartino 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 package dartino;
6
7 class BuilderSegment extends Segment {
8 public BuilderSegment(MessageBuilder builder, int id, int size) {
9 super(new byte[size]);
10 this.builder = builder;
11 this.id = id;
12 used = 0;
13 }
14
15 public boolean hasSpaceForBytes(int bytes) {
16 return used + bytes < buffer().capacity();
17 }
18
19 public int allocate(int bytes) {
20 if (!hasSpaceForBytes(bytes)) return -1;
21 int result = used;
22 used += bytes;
23 return result;
24 }
25
26 public int id() { return id; }
27 public int used() { return used; }
28 public MessageBuilder builder() { return builder; }
29
30 public boolean hasNext() { return next != null; }
31 public BuilderSegment next() { return next; }
32 public void setNext(BuilderSegment segment) { next = segment; }
33
34 private MessageBuilder builder;
35 private int id;
36 private BuilderSegment next;
37 private int used;
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698