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

Unified Diff: mojo/public/cpp/bindings/string_traits_standard.h

Issue 1966933002: Mojo C++ bindings: switch the existing usage of StructTraits to use the new data view interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@26_reader
Patch Set: typeid() is not allowed :/ Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/string_traits_standard.h
diff --git a/mojo/public/cpp/bindings/string_traits_standard.h b/mojo/public/cpp/bindings/string_traits_standard.h
index ba31f222cf0bd64eafea3a72613e5d8080925083..9b78d2473ec8a419db00db260cc34c946db32897 100644
--- a/mojo/public/cpp/bindings/string_traits_standard.h
+++ b/mojo/public/cpp/bindings/string_traits_standard.h
@@ -13,18 +13,15 @@ namespace mojo {
template <>
struct StringTraits<String> {
static bool IsNull(const String& input) { return input.is_null(); }
+ static void SetToNull(String* output) { *output = nullptr; }
static size_t GetSize(const String& input) { return input.size(); }
static const char* GetData(const String& input) { return input.data(); }
static bool Read(StringDataView input, String* output) {
- if (!input.is_null()) {
- String result(input.storage(), input.size());
- result.Swap(output);
- } else {
- *output = nullptr;
- }
+ String result(input.storage(), input.size());
+ result.Swap(output);
return true;
}
};

Powered by Google App Engine
This is Rietveld 408576698