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

Side by Side Diff: mojo/public/cpp/bindings/lib/string_serialization.h

Issue 2738643004: [Not for commit] Test performance impact if string validation checks whether it is utf8.
Patch Set: . Created 3 years, 9 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <string.h> 9 #include <string.h>
10 10
11 #include "base/metrics/histogram_macros.h"
11 #include "mojo/public/cpp/bindings/lib/array_internal.h" 12 #include "mojo/public/cpp/bindings/lib/array_internal.h"
12 #include "mojo/public/cpp/bindings/lib/serialization_forward.h" 13 #include "mojo/public/cpp/bindings/lib/serialization_forward.h"
13 #include "mojo/public/cpp/bindings/lib/serialization_util.h" 14 #include "mojo/public/cpp/bindings/lib/serialization_util.h"
14 #include "mojo/public/cpp/bindings/string_data_view.h" 15 #include "mojo/public/cpp/bindings/string_data_view.h"
15 #include "mojo/public/cpp/bindings/string_traits.h" 16 #include "mojo/public/cpp/bindings/string_traits.h"
16 17
17 namespace mojo { 18 namespace mojo {
18 namespace internal { 19 namespace internal {
19 20
20 template <typename MaybeConstUserType> 21 template <typename MaybeConstUserType>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 *output = result; 54 *output = result;
54 55
55 CustomContextHelper<Traits>::TearDown(input, custom_context); 56 CustomContextHelper<Traits>::TearDown(input, custom_context);
56 } 57 }
57 58
58 static bool Deserialize(String_Data* input, 59 static bool Deserialize(String_Data* input,
59 UserType* output, 60 UserType* output,
60 SerializationContext* context) { 61 SerializationContext* context) {
61 if (!input) 62 if (!input)
62 return CallSetToNullIfExists<Traits>(output); 63 return CallSetToNullIfExists<Traits>(output);
64 UMA_HISTOGRAM_COUNTS_100000("Experiment.MojomStringSize", input->size());
63 return Traits::Read(StringDataView(input, context), output); 65 return Traits::Read(StringDataView(input, context), output);
64 } 66 }
65 }; 67 };
66 68
67 } // namespace internal 69 } // namespace internal
68 } // namespace mojo 70 } // namespace mojo
69 71
70 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_ 72 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_STRING_SERIALIZATION_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/serialization.h ('k') | mojo/public/cpp/bindings/tests/bindings_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698