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

Side by Side Diff: third_party/protobuf/src/google/protobuf/arenastring.cc

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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 2008 Google Inc. All rights reserved. 2 // Copyright 2008 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 26 matching lines...) Expand all
37 namespace protobuf { 37 namespace protobuf {
38 namespace internal { 38 namespace internal {
39 39
40 40
41 void ArenaStringPtr::AssignWithDefault(const ::std::string* default_value, 41 void ArenaStringPtr::AssignWithDefault(const ::std::string* default_value,
42 ArenaStringPtr value) { 42 ArenaStringPtr value) {
43 const ::std::string* me = *UnsafeRawStringPointer(); 43 const ::std::string* me = *UnsafeRawStringPointer();
44 const ::std::string* other = *value.UnsafeRawStringPointer(); 44 const ::std::string* other = *value.UnsafeRawStringPointer();
45 // If the pointers are the same then do nothing. 45 // If the pointers are the same then do nothing.
46 if (me != other) { 46 if (me != other) {
47 SetNoArena(default_value, value.GetNoArena(default_value)); 47 SetNoArena(default_value, value.GetNoArena());
48 } 48 }
49 } 49 }
50 50
51 ::std::string* ArenaStringPtr::MutableNoArena( 51 ::std::string* ArenaStringPtr::MutableNoArena(
52 const ::std::string* default_value) { 52 const ::std::string* default_value) {
53 if (ptr_ == default_value) { 53 if (ptr_ == default_value) {
54 CreateInstanceNoArena(default_value); 54 CreateInstanceNoArena(default_value);
55 } 55 }
56 return ptr_; 56 return ptr_;
57 } 57 }
58 58
59 59
60 void ArenaStringPtr::DestroyNoArena(const ::std::string* default_value) { 60 void ArenaStringPtr::DestroyNoArena(const ::std::string* default_value) {
61 if (ptr_ != default_value) { 61 if (ptr_ != default_value) {
62 delete ptr_; 62 delete ptr_;
63 } 63 }
64 ptr_ = NULL; 64 ptr_ = NULL;
65 } 65 }
66 66
67 67
68 } // namespace internal 68 } // namespace internal
69 } // namespace protobuf 69 } // namespace protobuf
70 } // namespace google 70 } // namespace google
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698