google-protobuf 3.4.0.2-universal-darwin → 3.4.1.1-universal-darwin

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of google-protobuf might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6751f39d4c76d6a57c8979ba445eabad145878ea
4
- data.tar.gz: 4398686a5620b4d03e34d18793d2ce73b393eef4
3
+ metadata.gz: c45266f471e20e3e1a1583b86021d6a22d5a4713
4
+ data.tar.gz: 91d9c710a6748f856d8add39f8f2b5df99bab7df
5
5
  SHA512:
6
- metadata.gz: 71d70539087fe7240447342e7cf114d4711fbf69ba3f713c9e43ff7501d58263d35c2827993d3d81c295aac07c5c15a8ddd0cc5a37500d06a70a9960c482921c
7
- data.tar.gz: ff686a6a30ee945fa960fae1ff18ea3fdf96f2d9ef8bad0e758195429fe508b4d2edc4fe7a481718d17e939f5a4d4394de8e0de60cdb38b06ba8f3bcd9f87d36
6
+ metadata.gz: 171dd6b026440856a3c31c38864b04a4955faa9073010e22568447b903b6326a7023c9bca7e189f3112e4da631dd686fc30bb856b9edea49a5db4f13c6524b92
7
+ data.tar.gz: 481f4b66e84bd1431dd6601c56881f8b55ee24f68a9015873053a380b2ce263a3651b8e4ed15f455084501a1718fe49d00af026c29ba3f46237582307c82db3d
@@ -280,11 +280,6 @@ rb_data_type_t MapParseFrame_type = {
280
280
  { MapParseFrame_mark, MapParseFrame_free, NULL },
281
281
  };
282
282
 
283
- // Array of Ruby objects wrapping map_parse_frame_t.
284
- // We don't allow multiple concurrent decodes, so we assume that this global
285
- // variable is specific to the "current" decode.
286
- VALUE map_parse_frames;
287
-
288
283
  static map_parse_frame_t* map_push_frame(VALUE map,
289
284
  const map_handlerdata_t* handlerdata) {
290
285
  map_parse_frame_t* frame = ALLOC(map_parse_frame_t);
@@ -293,16 +288,12 @@ static map_parse_frame_t* map_push_frame(VALUE map,
293
288
  native_slot_init(handlerdata->key_field_type, &frame->key_storage);
294
289
  native_slot_init(handlerdata->value_field_type, &frame->value_storage);
295
290
 
296
- rb_ary_push(map_parse_frames,
291
+ Map_set_frame(map,
297
292
  TypedData_Wrap_Struct(rb_cObject, &MapParseFrame_type, frame));
298
293
 
299
294
  return frame;
300
295
  }
301
296
 
302
- static void map_pop_frame() {
303
- rb_ary_pop(map_parse_frames);
304
- }
305
-
306
297
  // Handler to begin a map entry: allocates a temporary frame. This is the
307
298
  // 'startsubmsg' handler on the msgdef that contains the map field.
308
299
  static void *startmapentry_handler(void *closure, const void *hd) {
@@ -336,7 +327,7 @@ static bool endmap_handler(void *closure, const void *hd, upb_status* s) {
336
327
  &frame->value_storage);
337
328
 
338
329
  Map_index_set(frame->map, key, value);
339
- map_pop_frame();
330
+ Map_set_frame(frame->map, Qnil);
340
331
 
341
332
  return true;
342
333
  }
@@ -775,10 +766,6 @@ VALUE Message_decode(VALUE klass, VALUE data) {
775
766
  msg_rb = rb_class_new_instance(0, NULL, msgklass);
776
767
  TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
777
768
 
778
- // We generally expect this to be clear already, but clear it in case parsing
779
- // previously got interrupted somehow.
780
- rb_ary_clear(map_parse_frames);
781
-
782
769
  {
783
770
  const upb_pbdecodermethod* method = msgdef_decodermethod(desc);
784
771
  const upb_handlers* h = upb_pbdecodermethod_desthandlers(method);
@@ -823,10 +810,6 @@ VALUE Message_decode_json(VALUE klass, VALUE data) {
823
810
  msg_rb = rb_class_new_instance(0, NULL, msgklass);
824
811
  TypedData_Get_Struct(msg_rb, MessageHeader, &Message_type, msg);
825
812
 
826
- // We generally expect this to be clear already, but clear it in case parsing
827
- // previously got interrupted somehow.
828
- rb_ary_clear(map_parse_frames);
829
-
830
813
  {
831
814
  const upb_json_parsermethod* method = msgdef_jsonparsermethod(desc);
832
815
  stackenv se;
@@ -146,6 +146,7 @@ void Map_mark(void* _self) {
146
146
  Map* self = _self;
147
147
 
148
148
  rb_gc_mark(self->value_type_class);
149
+ rb_gc_mark(self->parse_frame);
149
150
 
150
151
  if (self->value_type == UPB_TYPE_STRING ||
151
152
  self->value_type == UPB_TYPE_BYTES ||
@@ -174,6 +175,12 @@ VALUE Map_alloc(VALUE klass) {
174
175
  return TypedData_Wrap_Struct(klass, &Map_type, self);
175
176
  }
176
177
 
178
+ VALUE Map_set_frame(VALUE map, VALUE val) {
179
+ Map* self = ruby_to_Map(map);
180
+ self->parse_frame = val;
181
+ return val;
182
+ }
183
+
177
184
  static bool needs_typeclass(upb_fieldtype_t type) {
178
185
  switch (type) {
179
186
  case UPB_TYPE_MESSAGE:
@@ -227,6 +234,7 @@ VALUE Map_init(int argc, VALUE* argv, VALUE _self) {
227
234
 
228
235
  self->key_type = ruby_to_fieldtype(argv[0]);
229
236
  self->value_type = ruby_to_fieldtype(argv[1]);
237
+ self->parse_frame = Qnil;
230
238
 
231
239
  // Check that the key type is an allowed type.
232
240
  switch (self->key_type) {
@@ -112,6 +112,4 @@ void Init_protobuf_c() {
112
112
 
113
113
  upb_def_to_ruby_obj_map = rb_hash_new();
114
114
  rb_gc_register_address(&upb_def_to_ruby_obj_map);
115
- map_parse_frames = rb_ary_new();
116
- rb_gc_register_address(&map_parse_frames);
117
115
  }
@@ -166,8 +166,6 @@ extern VALUE cBuilder;
166
166
  extern VALUE cError;
167
167
  extern VALUE cParseError;
168
168
 
169
- extern VALUE map_parse_frames;
170
-
171
169
  // We forward-declare all of the Ruby method implementations here because we
172
170
  // sometimes call the methods directly across .c files, rather than going
173
171
  // through Ruby's method dispatching (e.g. during message parse). It's cleaner
@@ -397,6 +395,7 @@ typedef struct {
397
395
  upb_fieldtype_t key_type;
398
396
  upb_fieldtype_t value_type;
399
397
  VALUE value_type_class;
398
+ VALUE parse_frame;
400
399
  upb_strtable table;
401
400
  } Map;
402
401
 
@@ -405,6 +404,7 @@ void Map_free(void* self);
405
404
  VALUE Map_alloc(VALUE klass);
406
405
  VALUE Map_init(int argc, VALUE* argv, VALUE self);
407
406
  void Map_register(VALUE module);
407
+ VALUE Map_set_frame(VALUE self, VALUE val);
408
408
 
409
409
  extern const rb_data_type_t Map_type;
410
410
  extern VALUE cMap;
@@ -96,8 +96,18 @@ module BasicTest
96
96
  optional :d, :enum, 4, "TestEnum"
97
97
  end
98
98
  end
99
+
100
+ add_message "repro.Outer" do
101
+ map :items, :int32, :message, 1, "repro.Inner"
102
+ end
103
+
104
+ add_message "repro.Inner" do
105
+ end
99
106
  end
100
107
 
108
+
109
+ Outer = pool.lookup("repro.Outer").msgclass
110
+ Inner = pool.lookup("repro.Inner").msgclass
101
111
  Foo = pool.lookup("Foo").msgclass
102
112
  Bar = pool.lookup("Bar").msgclass
103
113
  Baz = pool.lookup("Baz").msgclass
@@ -675,6 +685,21 @@ module BasicTest
675
685
  m.map_string_int32['aaa'] = 3
676
686
  end
677
687
 
688
+ def test_concurrent_decoding
689
+ o = Outer.new
690
+ o.items[0] = Inner.new
691
+ raw = Outer.encode(o)
692
+
693
+ thds = 2.times.map do
694
+ Thread.new do
695
+ 100000.times do
696
+ assert_equal o, Outer.decode(raw)
697
+ end
698
+ end
699
+ end
700
+ thds.map(&:join)
701
+ end
702
+
678
703
  def test_map_encode_decode
679
704
  m = MapMessage.new(
680
705
  :map_string_int32 => {"a" => 1, "b" => 2},
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0.2
4
+ version: 3.4.1.1
5
5
  platform: universal-darwin
6
6
  authors:
7
7
  - Protobuf Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-17 00:00:00.000000000 Z
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler-dock