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

Unified Diff: mojo/public/cpp/bindings/string_traits.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.h
diff --git a/mojo/public/cpp/bindings/string_traits.h b/mojo/public/cpp/bindings/string_traits.h
index f0c4275c26497b3df8396efd866c05c8a4901078..cd3a34f1d408fd86285089a59d63daa50a0fe2cd 100644
--- a/mojo/public/cpp/bindings/string_traits.h
+++ b/mojo/public/cpp/bindings/string_traits.h
@@ -13,21 +13,13 @@ namespace mojo {
// Access to a string inside a mojo message.
class StringDataView {
public:
- explicit StringDataView(internal::String_Data* data) : data_(data) {}
-
- // Whether the data represents a null string.
- // Note: Must not access the following methods if this method returns true.
- bool is_null() const { return !data_; }
-
- const char* storage() const {
- DCHECK(!is_null());
- return data_->storage();
+ explicit StringDataView(internal::String_Data* data) : data_(data) {
+ DCHECK(data_);
}
- size_t size() const {
- DCHECK(!is_null());
- return data_->size();
- }
+ const char* storage() const { return data_->storage(); }
+
+ size_t size() const { return data_->size(); }
private:
internal::String_Data* data_;

Powered by Google App Engine
This is Rietveld 408576698