protobuf/src/google/protobuf/map_field_test.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #include <map>
32 #include <memory>
33 #include <unordered_map>
34 
35 #include <google/protobuf/stubs/logging.h>
36 #include <google/protobuf/stubs/common.h>
37 #include <google/protobuf/arena_test_util.h>
38 #include <google/protobuf/map_test_util.h>
39 #include <google/protobuf/map_unittest.pb.h>
40 #include <google/protobuf/unittest.pb.h>
41 #include <google/protobuf/arena.h>
42 #include <google/protobuf/map.h>
43 #include <google/protobuf/map_field_inl.h>
44 #include <google/protobuf/message.h>
45 #include <google/protobuf/repeated_field.h>
46 #include <gtest/gtest.h>
47 
48 // Must be included last.
49 #include <google/protobuf/port_def.inc>
50 
51 namespace google {
52 namespace protobuf {
53 
54 namespace internal {
55 
56 using unittest::TestAllTypes;
57 
58 class MapFieldBaseStub : public MapFieldBase {
59  public:
61  typedef void DestructorSkippable_;
64  // Get underlined repeated field without synchronizing map.
66  bool IsMapClean() {
67  return state_.load(std::memory_order_relaxed) != STATE_MODIFIED_MAP;
68  }
69  bool IsRepeatedClean() {
70  return state_.load(std::memory_order_relaxed) != STATE_MODIFIED_REPEATED;
71  }
72  void SetMapDirty() {
73  state_.store(STATE_MODIFIED_MAP, std::memory_order_relaxed);
74  }
76  state_.store(STATE_MODIFIED_REPEATED, std::memory_order_relaxed);
77  }
78  bool ContainsMapKey(const MapKey& map_key) const override { return false; }
79  bool InsertOrLookupMapValue(const MapKey& map_key,
80  MapValueRef* val) override {
81  return false;
82  }
83  bool LookupMapValue(const MapKey& map_key,
84  MapValueConstRef* val) const override {
85  return false;
86  }
87  bool DeleteMapValue(const MapKey& map_key) override { return false; }
88  bool EqualIterator(const MapIterator& a,
89  const MapIterator& b) const override {
90  return false;
91  }
92  int size() const override { return 0; }
93  void Clear() override {}
94  void MapBegin(MapIterator* map_iter) const override {}
95  void MapEnd(MapIterator* map_iter) const override {}
96  void MergeFrom(const MapFieldBase& other) override {}
97  void Swap(MapFieldBase* other) override {}
98  void InitializeIterator(MapIterator* map_iter) const override {}
99  void DeleteIterator(MapIterator* map_iter) const override {}
100  void CopyIterator(MapIterator* this_iterator,
101  const MapIterator& other_iterator) const override {}
102  void IncreaseIterator(MapIterator* map_iter) const override {}
103 
106  return repeated_field->GetArena();
107  }
108 };
109 
110 class MapFieldBasePrimitiveTest : public testing::TestWithParam<bool> {
111  protected:
112  typedef unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType;
116 
118  : arena_(GetParam() ? new Arena() : nullptr),
119  map_field_(arena_.get()),
121  // Get descriptors
123  ->FindFieldByName("map_int32_int32")
124  ->message_type();
127 
128  // Build map field
129  map_field_base_ = map_field_.get();
130  map_ = map_field_->MutableMap();
131  initial_value_map_[0] = 100;
132  initial_value_map_[1] = 101;
134  EXPECT_EQ(2, map_->size());
135  }
136 
137  std::unique_ptr<Arena> arena_;
144  std::map<int32, int32> initial_value_map_; // copy of initial values inserted
145 };
146 
147 INSTANTIATE_TEST_SUITE_P(MapFieldBasePrimitiveTestInstance,
149  testing::Values(true, false));
150 
151 TEST_P(MapFieldBasePrimitiveTest, SpaceUsedExcludingSelf) {
152  EXPECT_LT(0, map_field_base_->SpaceUsedExcludingSelf());
153 }
154 
155 TEST_P(MapFieldBasePrimitiveTest, GetRepeatedField) {
157  reinterpret_cast<const RepeatedPtrField<Message>&>(
158  map_field_base_->GetRepeatedField());
159  EXPECT_EQ(2, repeated.size());
160  for (int i = 0; i < repeated.size(); i++) {
161  const Message& message = repeated.Get(i);
162  int key = message.GetReflection()->GetInt32(message, key_descriptor_);
163  int value = message.GetReflection()->GetInt32(message, value_descriptor_);
164  EXPECT_EQ(value, initial_value_map_[key]);
165  }
166 }
167 
168 TEST_P(MapFieldBasePrimitiveTest, MutableRepeatedField) {
170  reinterpret_cast<RepeatedPtrField<Message>*>(
171  map_field_base_->MutableRepeatedField());
172  EXPECT_EQ(2, repeated->size());
173  for (int i = 0; i < repeated->size(); i++) {
174  const Message& message = repeated->Get(i);
175  int key = message.GetReflection()->GetInt32(message, key_descriptor_);
176  int value = message.GetReflection()->GetInt32(message, value_descriptor_);
177  EXPECT_EQ(value, initial_value_map_[key]);
178  }
179 }
180 
182  // Allocate a large initial block to avoid mallocs during hooked test.
183  std::vector<char> arena_block(128 * 1024);
185  options.initial_block = &arena_block[0];
186  options.initial_block_size = arena_block.size();
188 
189  {
190  // TODO(liujisi): Re-write the test to ensure the memory for the map and
191  // repeated fields are allocated from arenas.
192  // NoHeapChecker no_heap;
193 
194  MapFieldType* map_field = Arena::CreateMessage<MapFieldType>(&arena);
195 
196  // Set content in map
197  (*map_field->MutableMap())[100] = 101;
198 
199  // Trigger conversion to repeated field.
200  map_field->GetRepeatedField();
201  }
202 
203  {
204  // TODO(liujisi): Re-write the test to ensure the memory for the map and
205  // repeated fields are allocated from arenas.
206  // NoHeapChecker no_heap;
207 
208  MapFieldBaseStub* map_field =
209  Arena::CreateMessage<MapFieldBaseStub>(&arena);
210 
211  // Trigger conversion to repeated field.
212  EXPECT_TRUE(map_field->MutableRepeatedField() != nullptr);
213 
214  EXPECT_EQ(map_field->GetArenaForInternalRepeatedField(), &arena);
215  }
216 }
217 
219  std::unique_ptr<MapFieldBaseStub> map_field(
220  Arena::CreateMessage<MapFieldBaseStub>(nullptr));
221  EXPECT_EQ(map_field->GetArenaForInternalRepeatedField(), nullptr);
222 }
223 
224 namespace {
225 enum State { CLEAN, MAP_DIRTY, REPEATED_DIRTY };
226 } // anonymous namespace
227 
228 class MapFieldStateTest
229  : public testing::TestWithParam<std::tuple<State, bool>> {
230  protected:
231  typedef unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType;
236  : arena_(std::get<1>(GetParam()) ? new Arena() : nullptr),
237  map_field_(arena_.get()),
239  state_(std::get<0>(GetParam())) {
240  // Build map field
241  Expect(map_field_.get(), MAP_DIRTY, 0, 0, true);
242  switch (state_) {
243  case CLEAN:
245  break;
246  case MAP_DIRTY:
247  MakeMapDirty(map_field_.get());
248  break;
249  case REPEATED_DIRTY:
251  break;
252  default:
253  break;
254  }
255  }
256 
257  void AddOneStillClean(MapFieldType* map_field) {
258  MapFieldBase* map_field_base = map_field;
259  Map<int32, int32>* map = map_field->MutableMap();
260  (*map)[0] = 0;
261  map_field_base->GetRepeatedField();
262  Expect(map_field, CLEAN, 1, 1, false);
263  }
264 
265  void MakeMapDirty(MapFieldType* map_field) {
266  Map<int32, int32>* map = map_field->MutableMap();
267  (*map)[0] = 0;
268  Expect(map_field, MAP_DIRTY, 1, 0, true);
269  }
270 
271  void MakeRepeatedDirty(MapFieldType* map_field) {
272  MakeMapDirty(map_field);
273  MapFieldBase* map_field_base = map_field;
274  map_field_base->MutableRepeatedField();
275  // We use MutableMap on impl_ because we don't want to disturb the syncing
276  Map<int32, int32>* map = map_field->impl_.MutableMap();
277  map->clear();
278 
279  Expect(map_field, REPEATED_DIRTY, 0, 1, false);
280  }
281 
282  void Expect(MapFieldType* map_field, State state, int map_size,
283  int repeated_size, bool is_repeated_null) {
284  MapFieldBase* map_field_base = map_field;
286  reinterpret_cast<MapFieldBaseStub*>(map_field_base);
287 
288  // We use MutableMap on impl_ because we don't want to disturb the syncing
289  Map<int32, int32>* map = map_field->impl_.MutableMap();
290  RepeatedPtrField<Message>* repeated_field = stub->InternalRepeatedField();
291 
292  switch (state) {
293  case MAP_DIRTY:
294  EXPECT_FALSE(stub->IsMapClean());
295  EXPECT_TRUE(stub->IsRepeatedClean());
296  break;
297  case REPEATED_DIRTY:
298  EXPECT_TRUE(stub->IsMapClean());
299  EXPECT_FALSE(stub->IsRepeatedClean());
300  break;
301  case CLEAN:
302  EXPECT_TRUE(stub->IsMapClean());
303  EXPECT_TRUE(stub->IsRepeatedClean());
304  break;
305  default:
306  FAIL();
307  }
308 
309  EXPECT_EQ(map_size, map->size());
310  if (is_repeated_null) {
311  EXPECT_TRUE(repeated_field == nullptr);
312  } else {
313  if (repeated_field == nullptr) {
314  EXPECT_EQ(repeated_size, 0);
315  } else {
316  EXPECT_EQ(repeated_size, repeated_field->size());
317  }
318  }
319  }
320 
321  std::unique_ptr<Arena> arena_;
324  State state_;
325 };
326 
327 INSTANTIATE_TEST_SUITE_P(MapFieldStateTestInstance, MapFieldStateTest,
328  testing::Combine(testing::Values(CLEAN, MAP_DIRTY,
329  REPEATED_DIRTY),
330  testing::Values(true, false)));
331 
333  map_field_->GetMap();
334  if (state_ != MAP_DIRTY) {
335  Expect(map_field_.get(), CLEAN, 1, 1, false);
336  } else {
337  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
338  }
339 }
340 
341 TEST_P(MapFieldStateTest, MutableMap) {
342  map_field_->MutableMap();
343  if (state_ != MAP_DIRTY) {
344  Expect(map_field_.get(), MAP_DIRTY, 1, 1, false);
345  } else {
346  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
347  }
348 }
349 
350 TEST_P(MapFieldStateTest, MergeFromClean) {
351  ArenaHolder<MapFieldType> other(arena_.get());
352  AddOneStillClean(other.get());
353 
354  map_field_->MergeFrom(*other);
355 
356  if (state_ != MAP_DIRTY) {
357  Expect(map_field_.get(), MAP_DIRTY, 1, 1, false);
358  } else {
359  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
360  }
361 
362  Expect(other.get(), CLEAN, 1, 1, false);
363 }
364 
365 TEST_P(MapFieldStateTest, MergeFromMapDirty) {
366  ArenaHolder<MapFieldType> other(arena_.get());
367  MakeMapDirty(other.get());
368 
369  map_field_->MergeFrom(*other);
370 
371  if (state_ != MAP_DIRTY) {
372  Expect(map_field_.get(), MAP_DIRTY, 1, 1, false);
373  } else {
374  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
375  }
376 
377  Expect(other.get(), MAP_DIRTY, 1, 0, true);
378 }
379 
380 TEST_P(MapFieldStateTest, MergeFromRepeatedDirty) {
381  ArenaHolder<MapFieldType> other(arena_.get());
382  MakeRepeatedDirty(other.get());
383 
384  map_field_->MergeFrom(*other);
385 
386  if (state_ != MAP_DIRTY) {
387  Expect(map_field_.get(), MAP_DIRTY, 1, 1, false);
388  } else {
389  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
390  }
391 
392  Expect(other.get(), CLEAN, 1, 1, false);
393 }
394 
395 TEST_P(MapFieldStateTest, SwapClean) {
396  ArenaHolder<MapFieldType> other(arena_.get());
397  AddOneStillClean(other.get());
398 
399  map_field_->Swap(other.get());
400 
401  Expect(map_field_.get(), CLEAN, 1, 1, false);
402 
403  switch (state_) {
404  case CLEAN:
405  Expect(other.get(), CLEAN, 1, 1, false);
406  break;
407  case MAP_DIRTY:
408  Expect(other.get(), MAP_DIRTY, 1, 0, true);
409  break;
410  case REPEATED_DIRTY:
411  Expect(other.get(), REPEATED_DIRTY, 0, 1, false);
412  break;
413  default:
414  break;
415  }
416 }
417 
418 TEST_P(MapFieldStateTest, SwapMapDirty) {
419  ArenaHolder<MapFieldType> other(arena_.get());
420  MakeMapDirty(other.get());
421 
422  map_field_->Swap(other.get());
423 
424  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
425 
426  switch (state_) {
427  case CLEAN:
428  Expect(other.get(), CLEAN, 1, 1, false);
429  break;
430  case MAP_DIRTY:
431  Expect(other.get(), MAP_DIRTY, 1, 0, true);
432  break;
433  case REPEATED_DIRTY:
434  Expect(other.get(), REPEATED_DIRTY, 0, 1, false);
435  break;
436  default:
437  break;
438  }
439 }
440 
441 TEST_P(MapFieldStateTest, SwapRepeatedDirty) {
442  ArenaHolder<MapFieldType> other(arena_.get());
443  MakeRepeatedDirty(other.get());
444 
445  map_field_->Swap(other.get());
446 
447  Expect(map_field_.get(), REPEATED_DIRTY, 0, 1, false);
448 
449  switch (state_) {
450  case CLEAN:
451  Expect(other.get(), CLEAN, 1, 1, false);
452  break;
453  case MAP_DIRTY:
454  Expect(other.get(), MAP_DIRTY, 1, 0, true);
455  break;
456  case REPEATED_DIRTY:
457  Expect(other.get(), REPEATED_DIRTY, 0, 1, false);
458  break;
459  default:
460  break;
461  }
462 }
463 
464 TEST_P(MapFieldStateTest, Clear) {
465  map_field_->Clear();
466 
467  Expect(map_field_.get(), MAP_DIRTY, 0, 0, false);
468 }
469 
470 TEST_P(MapFieldStateTest, SpaceUsedExcludingSelf) {
471  map_field_base_->SpaceUsedExcludingSelf();
472 
473  switch (state_) {
474  case CLEAN:
475  Expect(map_field_.get(), CLEAN, 1, 1, false);
476  break;
477  case MAP_DIRTY:
478  Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
479  break;
480  case REPEATED_DIRTY:
481  Expect(map_field_.get(), REPEATED_DIRTY, 0, 1, false);
482  break;
483  default:
484  break;
485  }
486 }
487 
488 TEST_P(MapFieldStateTest, GetMapField) {
489  map_field_base_->GetRepeatedField();
490 
491  if (state_ != REPEATED_DIRTY) {
492  Expect(map_field_.get(), CLEAN, 1, 1, false);
493  } else {
494  Expect(map_field_.get(), REPEATED_DIRTY, 0, 1, false);
495  }
496 }
497 
498 TEST_P(MapFieldStateTest, MutableMapField) {
499  map_field_base_->MutableRepeatedField();
500 
501  if (state_ != REPEATED_DIRTY) {
502  Expect(map_field_.get(), REPEATED_DIRTY, 1, 1, false);
503  } else {
504  Expect(map_field_.get(), REPEATED_DIRTY, 0, 1, false);
505  }
506 }
507 
509  : public MapField<unittest::TestMap_MapInt32Int32Entry_DoNotUse, int32,
510  int32, internal::WireFormatLite::TYPE_INT32,
511  internal::WireFormatLite::TYPE_INT32> {
512  public:
513  constexpr MyMapField()
515 };
516 
517 TEST(MapFieldTest, ConstInit) {
518  // This tests that `MapField` and all its base classes can be constant
519  // initialized.
520  PROTOBUF_CONSTINIT static MyMapField field; // NOLINT
521  EXPECT_EQ(field.size(), 0);
522 }
523 
524 
525 } // namespace internal
526 } // namespace protobuf
527 } // namespace google
google::protobuf.internal::MapFieldBasePrimitiveTest::map_field_base_
MapFieldBase * map_field_base_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:124
EXPECT_FALSE
#define EXPECT_FALSE(condition)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1970
google::protobuf.internal::MapFieldBaseStub
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:55
google::protobuf.internal::MapFieldBase::STATE_MODIFIED_MAP
@ STATE_MODIFIED_MAP
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:140
google::protobuf::Descriptor::map_key
const FieldDescriptor * map_key() const
Definition: protobuf/src/google/protobuf/descriptor.cc:2320
google::protobuf::RepeatedPtrField
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.h:62
google::protobuf.internal::MapFieldBasePrimitiveTest::value_descriptor_
const FieldDescriptor * value_descriptor_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:128
google::protobuf::value
const Descriptor::ReservedRange value
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1954
google::protobuf::FieldDescriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:515
get
absl::string_view get(const Cont &c)
Definition: abseil-cpp/absl/strings/str_replace_test.cc:185
google::protobuf.internal::MapFieldBasePrimitiveTest::map_field_
std::unique_ptr< MapFieldType > map_field_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:123
google::protobuf.internal::MapFieldLite::MutableMap
Map< Key, T > * MutableMap()
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_lite.h:72
google::protobuf.internal::MapFieldBaseStub::EqualIterator
bool EqualIterator(const MapIterator &a, const MapIterator &b) const override
Definition: protobuf/src/google/protobuf/map_field_test.cc:88
google::protobuf.internal::MapFieldStateTest::Expect
void Expect(MapFieldType *map_field, State state, int map_size, int repeated_size, bool is_repeated_null)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:254
google::protobuf.internal::MyMapField::MyMapField
constexpr MyMapField()
Definition: protobuf/src/google/protobuf/map_field_test.cc:513
google::protobuf.internal::MapFieldBaseStub::LookupMapValue
bool LookupMapValue(const MapKey &map_key, MapValueConstRef *val) const override
Definition: protobuf/src/google/protobuf/map_field_test.cc:83
google::protobuf.internal::MapField
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/map.h:78
google::protobuf.internal::MapFieldBaseStub::SetRepeatedDirty
void SetRepeatedDirty()
Definition: protobuf/src/google/protobuf/map_field_test.cc:75
google::protobuf.internal::MapFieldStateTest::AddOneStillClean
void AddOneStillClean(MapFieldType *map_field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:229
options
double_dict options[]
Definition: capstone_test.c:55
google::protobuf.internal::MapFieldBaseStub::MergeFrom
void MergeFrom(const MapFieldBase &other) override
Definition: protobuf/src/google/protobuf/map_field_test.cc:96
google::protobuf.internal::ConstantInitialized
Definition: protobuf/src/google/protobuf/message_lite.h:88
google::protobuf.internal::INSTANTIATE_TEST_SUITE_P
INSTANTIATE_TEST_SUITE_P(MapFieldStateTestInstance, MapFieldStateTest, ::testing::Values(CLEAN, MAP_DIRTY, REPEATED_DIRTY))
google::protobuf.internal::MapFieldBase::GetRepeatedField
const RepeatedPtrFieldBase & GetRepeatedField() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.cc:46
google::protobuf.internal::MapFieldBaseStub::InternalRepeatedField
RepeatedPtrField< Message > * InternalRepeatedField()
Definition: protobuf/src/google/protobuf/map_field_test.cc:65
Arena
Definition: arena.c:39
google::protobuf.internal::MapFieldBaseStub::GetArenaForInternalRepeatedField
Arena * GetArenaForInternalRepeatedField()
Definition: protobuf/src/google/protobuf/map_field_test.cc:104
google::protobuf.internal::MapFieldStateTest::map_field_base_
MapFieldBase * map_field_base_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:294
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
google::protobuf.internal::MapFieldStateTest::map_field_
ArenaHolder< MapFieldType > map_field_
Definition: protobuf/src/google/protobuf/map_field_test.cc:322
google::protobuf::Map::insert
std::pair< iterator, bool > insert(const value_type &value)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/map.h:1101
google::protobuf.internal::MapFieldBaseStub::MapFieldBaseStub
MapFieldBaseStub(Arena *arena)
Definition: protobuf/src/google/protobuf/map_field_test.cc:63
google::protobuf.internal::MapFieldBaseStub::DeleteIterator
void DeleteIterator(MapIterator *map_iter) const override
Definition: protobuf/src/google/protobuf/map_field_test.cc:99
async_greeter_client.stub
stub
Definition: hellostreamingworld/async_greeter_client.py:26
google::protobuf.internal::MapFieldBaseStub::Swap
void Swap(MapFieldBase *other) override
Definition: protobuf/src/google/protobuf/map_field_test.cc:97
env.new
def new
Definition: env.py:51
map
zval * map
Definition: php/ext/google/protobuf/encode_decode.c:480
map_field_
std::string map_field_
Definition: bloaty/third_party/protobuf/src/google/protobuf/util/message_differencer_unittest.cc:2420
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
google::protobuf.internal::MapField::MutableMap
Map< Key, T > * MutableMap() override
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:259
google::protobuf.internal::MapFieldBase::state_
std::atomic< State > state_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:153
repeated_field
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern repeated_field
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/array.c:486
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
google::protobuf.internal::MapFieldBaseStub::size
int size() const override
Definition: protobuf/src/google/protobuf/map_field_test.cc:92
testing::TestWithParam
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1883
google::protobuf.internal::MapFieldStateTest::map_field_
std::unique_ptr< MapFieldType > map_field_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:293
EXPECT_EQ
#define EXPECT_EQ(a, b)
Definition: iomgr/time_averaged_stats_test.cc:27
google::protobuf.internal::MapFieldBaseStub::CopyIterator
void CopyIterator(MapIterator *this_iterator, const MapIterator &other_iterator) const override
Definition: protobuf/src/google/protobuf/map_field_test.cc:100
google::protobuf.internal::MapFieldBasePrimitiveTest
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:98
google::protobuf.internal::MapFieldBaseStub::ContainsMapKey
bool ContainsMapKey(const MapKey &map_key) const override
Definition: protobuf/src/google/protobuf/map_field_test.cc:78
google::protobuf.internal::MapFieldBasePrimitiveTest::key_descriptor_
const FieldDescriptor * key_descriptor_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:127
google::protobuf.internal::ArenaHolder
Definition: protobuf/src/google/protobuf/arena_test_util.h:98
google::protobuf.internal::MapFieldBaseStub::SetMapDirty
void SetMapDirty()
Definition: protobuf/src/google/protobuf/map_field_test.cc:72
google::protobuf::int32
int32_t int32
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/stubs/port.h:150
google::protobuf.internal::MapFieldBaseStub::IsMapClean
bool IsMapClean()
Definition: protobuf/src/google/protobuf/map_field_test.cc:66
google::protobuf.internal::MapFieldStateTest::MapFieldStateTest
MapFieldStateTest()
Definition: protobuf/src/google/protobuf/map_field_test.cc:235
arena_
Arena * arena_
Definition: client_channel.cc:391
google::protobuf.internal::MapField::impl_
MapFieldLiteType impl_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:297
google::protobuf.internal::MapFieldStateTest::MapFieldType
MapField< EntryType, int32, int32, WireFormatLite::TYPE_INT32, WireFormatLite::TYPE_INT32 > MapFieldType
Definition: protobuf/src/google/protobuf/map_field_test.cc:234
google::protobuf::python::GetMap
static MapContainer * GetMap(PyObject *obj)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/map_container.cc:307
google::protobuf.internal::MapFieldBaseStub::IsRepeatedClean
bool IsRepeatedClean()
Definition: protobuf/src/google/protobuf/map_field_test.cc:69
google::protobuf.internal::MapFieldStateTest::state_
State state_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:295
google::protobuf.internal::MapFieldBase::repeated_field_
RepeatedPtrField< Message > * repeated_field_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:148
google::protobuf.internal::MapFieldBaseStub::DeleteMapValue
bool DeleteMapValue(const MapKey &map_key) override
Definition: protobuf/src/google/protobuf/map_field_test.cc:87
google::protobuf.internal::MapFieldBaseStub::Clear
void Clear() override
Definition: protobuf/src/google/protobuf/map_field_test.cc:93
google::protobuf.internal::MapFieldBaseStub::DestructorSkippable_
void DestructorSkippable_
Definition: protobuf/src/google/protobuf/map_field_test.cc:61
FAIL
@ FAIL
Definition: call_creds.cc:42
google::protobuf.internal::MyMapField
Definition: protobuf/src/google/protobuf/map_field_test.cc:508
google::protobuf.internal::MapFieldStateTest::arena_
std::unique_ptr< Arena > arena_
Definition: protobuf/src/google/protobuf/map_field_test.cc:321
google::protobuf.internal::MapFieldBaseStub::InitializeIterator
void InitializeIterator(MapIterator *map_iter) const override
Definition: protobuf/src/google/protobuf/map_field_test.cc:98
google::protobuf.internal::MapFieldBasePrimitiveTest::map_field_
ArenaHolder< MapFieldType > map_field_
Definition: protobuf/src/google/protobuf/map_field_test.cc:138
google::protobuf.internal::MapFieldBasePrimitiveTest::arena_
std::unique_ptr< Arena > arena_
Definition: protobuf/src/google/protobuf/map_field_test.cc:137
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
google::protobuf.internal::MapFieldBase::STATE_MODIFIED_REPEATED
@ STATE_MODIFIED_REPEATED
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:142
google::protobuf.internal::MapFieldStateTest::MakeRepeatedDirty
void MakeRepeatedDirty(MapFieldType *map_field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:243
google::protobuf::ArenaOptions
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/arena.h:117
google::protobuf::Message
Definition: bloaty/third_party/protobuf/src/google/protobuf/message.h:205
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
key
const char * key
Definition: hpack_parser_table.cc:164
testing::Values
internal::ValueArray< T... > Values(T... v)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest-param-test.h:335
google::protobuf.internal::TEST_P
TEST_P(MapFieldStateTest, GetMap)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:301
google::protobuf.internal.python_message.Clear
Clear
Definition: bloaty/third_party/protobuf/python/google/protobuf/internal/python_message.py:1430
google::protobuf.internal::MapFieldBasePrimitiveTest::MapFieldType
MapField< EntryType, int32, int32, WireFormatLite::TYPE_INT32, WireFormatLite::TYPE_INT32 > MapFieldType
Definition: protobuf/src/google/protobuf/map_field_test.cc:115
testing::Combine
internal::CartesianProductHolder< Generator... > Combine(const Generator &... g)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest-param-test.h:410
google::protobuf::MapKey
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:371
google::protobuf.internal::MapFieldBaseStub::MapBegin
void MapBegin(MapIterator *map_iter) const override
Definition: protobuf/src/google/protobuf/map_field_test.cc:94
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
EXPECT_LT
#define EXPECT_LT(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2032
google::protobuf.internal::MapFieldBase::MutableRepeatedField
RepeatedPtrFieldBase * MutableRepeatedField()
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.cc:51
google::protobuf.internal::MapFieldBasePrimitiveTest::map_descriptor_
const Descriptor * map_descriptor_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:126
google::protobuf.internal::MapFieldBaseStub::InsertOrLookupMapValue
bool InsertOrLookupMapValue(const MapKey &map_key, MapValueRef *val) override
Definition: protobuf/src/google/protobuf/map_field_test.cc:79
testing::WithParamInterface< State >::GetParam
static const ParamType & GetParam()
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1855
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
google::protobuf::Descriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:231
google::protobuf.internal::MapFieldStateTest
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:201
google::protobuf::Map::size
size_type size() const
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/map.h:1045
google::protobuf.internal::TEST
TEST(GeneratedMapFieldTest, Accessors)
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/map_test.cc:1847
state_
grpc_connectivity_state state_
Definition: channel_connectivity.cc:213
google::protobuf.internal::MapFieldBaseStub::IncreaseIterator
void IncreaseIterator(MapIterator *map_iter) const override
Definition: protobuf/src/google/protobuf/map_field_test.cc:102
google::protobuf.internal::WireFormatLite::TYPE_INT32
@ TYPE_INT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/wire_format_lite.h:116
EXPECT_TRUE
#define EXPECT_TRUE(condition)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1967
google::protobuf.internal::MapFieldBasePrimitiveTest::MapFieldBasePrimitiveTest
MapFieldBasePrimitiveTest()
Definition: protobuf/src/google/protobuf/map_field_test.cc:117
google::protobuf::Map< int32, int32 >
internal
Definition: benchmark/test/output_test_helper.cc:20
google::protobuf.internal::MapFieldBase
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:69
google::protobuf.internal::MapFieldStateTest::MakeMapDirty
void MakeMapDirty(MapFieldType *map_field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:237
google::protobuf::Descriptor::map_value
const FieldDescriptor * map_value() const
Definition: protobuf/src/google/protobuf/descriptor.cc:2326
google::protobuf.internal::MapFieldBasePrimitiveTest::map_
Map< int32, int32 > * map_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:125
google::protobuf.internal::MapFieldStateTest::EntryType
unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType
Definition: protobuf/src/google/protobuf/map_field_test.cc:231
google::protobuf.internal::MapFieldBasePrimitiveTest::initial_value_map_
std::map< int32, int32 > initial_value_map_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field_test.cc:129
google::protobuf.internal::MapFieldBaseStub::MapFieldBaseStub
MapFieldBaseStub()
Definition: protobuf/src/google/protobuf/map_field_test.cc:62
google::protobuf::MapIterator
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:712
google::protobuf.internal::MapFieldBaseStub::InternalArenaConstructable_
void InternalArenaConstructable_
Definition: protobuf/src/google/protobuf/map_field_test.cc:60
google::protobuf.internal::MapFieldBasePrimitiveTest::EntryType
unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType
Definition: protobuf/src/google/protobuf/map_field_test.cc:112
descriptor
static const char descriptor[1336]
Definition: certs.upbdefs.c:16
repeated
static grpc_slice repeated(char c, size_t length)
Definition: message_compress_test.cc:109
google::protobuf.internal::MapFieldBaseStub::MapEnd
void MapEnd(MapIterator *map_iter) const override
Definition: protobuf/src/google/protobuf/map_field_test.cc:95
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
testing::internal::Expect
void Expect(bool condition, const char *file, int line, const std::string &msg)
Definition: bloaty/third_party/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:282
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
google::protobuf::MapValueConstRef
Definition: protobuf/src/google/protobuf/map_field.h:685
google::protobuf::MapValueRef
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_field.h:565


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:20