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

Side by Side Diff: third_party/protobuf/ruby/ext/google/protobuf_c/defs.c

Issue 1983203003: Update third_party/protobuf to protobuf-v3.0.0-beta-3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: owners 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
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2014 Google Inc. All rights reserved. 2 // Copyright 2014 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 upb_msgdef_unref(self->msgdef, &self->msgdef); 236 upb_msgdef_unref(self->msgdef, &self->msgdef);
237 if (self->layout) { 237 if (self->layout) {
238 free_layout(self->layout); 238 free_layout(self->layout);
239 } 239 }
240 if (self->fill_handlers) { 240 if (self->fill_handlers) {
241 upb_handlers_unref(self->fill_handlers, &self->fill_handlers); 241 upb_handlers_unref(self->fill_handlers, &self->fill_handlers);
242 } 242 }
243 if (self->fill_method) { 243 if (self->fill_method) {
244 upb_pbdecodermethod_unref(self->fill_method, &self->fill_method); 244 upb_pbdecodermethod_unref(self->fill_method, &self->fill_method);
245 } 245 }
246 if (self->json_fill_method) {
247 upb_json_parsermethod_unref(self->json_fill_method,
248 &self->json_fill_method);
249 }
246 if (self->pb_serialize_handlers) { 250 if (self->pb_serialize_handlers) {
247 upb_handlers_unref(self->pb_serialize_handlers, 251 upb_handlers_unref(self->pb_serialize_handlers,
248 &self->pb_serialize_handlers); 252 &self->pb_serialize_handlers);
249 } 253 }
250 if (self->json_serialize_handlers) { 254 if (self->json_serialize_handlers) {
251 upb_handlers_unref(self->json_serialize_handlers, 255 upb_handlers_unref(self->json_serialize_handlers,
252 &self->json_serialize_handlers); 256 &self->json_serialize_handlers);
253 } 257 }
258 if (self->json_serialize_handlers_preserve) {
259 upb_handlers_unref(self->json_serialize_handlers_preserve,
260 &self->json_serialize_handlers_preserve);
261 }
254 xfree(self); 262 xfree(self);
255 } 263 }
256 264
257 /* 265 /*
258 * call-seq: 266 * call-seq:
259 * Descriptor.new => descriptor 267 * Descriptor.new => descriptor
260 * 268 *
261 * Creates a new, empty, message type descriptor. At a minimum, its name must be 269 * Creates a new, empty, message type descriptor. At a minimum, its name must be
262 * set before it is added to a pool. It cannot be used to create messages until 270 * set before it is added to a pool. It cannot be used to create messages until
263 * it is added to a pool, after which it becomes immutable (as part of a 271 * it is added to a pool, after which it becomes immutable (as part of a
264 * finalization process). 272 * finalization process).
265 */ 273 */
266 VALUE Descriptor_alloc(VALUE klass) { 274 VALUE Descriptor_alloc(VALUE klass) {
267 Descriptor* self = ALLOC(Descriptor); 275 Descriptor* self = ALLOC(Descriptor);
268 VALUE ret = TypedData_Wrap_Struct(klass, &_Descriptor_type, self); 276 VALUE ret = TypedData_Wrap_Struct(klass, &_Descriptor_type, self);
269 self->msgdef = upb_msgdef_new(&self->msgdef); 277 self->msgdef = upb_msgdef_new(&self->msgdef);
270 self->klass = Qnil; 278 self->klass = Qnil;
271 self->layout = NULL; 279 self->layout = NULL;
272 self->fill_handlers = NULL; 280 self->fill_handlers = NULL;
273 self->fill_method = NULL; 281 self->fill_method = NULL;
282 self->json_fill_method = NULL;
274 self->pb_serialize_handlers = NULL; 283 self->pb_serialize_handlers = NULL;
275 self->json_serialize_handlers = NULL; 284 self->json_serialize_handlers = NULL;
285 self->json_serialize_handlers_preserve = NULL;
276 self->typeclass_references = rb_ary_new(); 286 self->typeclass_references = rb_ary_new();
277 return ret; 287 return ret;
278 } 288 }
279 289
280 void Descriptor_register(VALUE module) { 290 void Descriptor_register(VALUE module) {
281 VALUE klass = rb_define_class_under( 291 VALUE klass = rb_define_class_under(
282 module, "Descriptor", rb_cObject); 292 module, "Descriptor", rb_cObject);
283 rb_define_alloc_func(klass, Descriptor_alloc); 293 rb_define_alloc_func(klass, Descriptor_alloc);
284 rb_define_method(klass, "each", Descriptor_each, 0); 294 rb_define_method(klass, "each", Descriptor_each, 0);
285 rb_define_method(klass, "lookup", Descriptor_lookup, 1); 295 rb_define_method(klass, "lookup", Descriptor_lookup, 1);
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 "Unable to add defs to DescriptorPool"); 1754 "Unable to add defs to DescriptorPool");
1745 1755
1746 for (int i = 0; i < RARRAY_LEN(self->pending_list); i++) { 1756 for (int i = 0; i < RARRAY_LEN(self->pending_list); i++) {
1747 VALUE def_rb = rb_ary_entry(self->pending_list, i); 1757 VALUE def_rb = rb_ary_entry(self->pending_list, i);
1748 add_def_obj(self->defs[i], def_rb); 1758 add_def_obj(self->defs[i], def_rb);
1749 } 1759 }
1750 1760
1751 self->pending_list = rb_ary_new(); 1761 self->pending_list = rb_ary_new();
1752 return Qnil; 1762 return Qnil;
1753 } 1763 }
OLDNEW
« no previous file with comments | « third_party/protobuf/ruby/Rakefile ('k') | third_party/protobuf/ruby/ext/google/protobuf_c/encode_decode.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698