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

Side by Side Diff: mojo/public/cpp/bindings/lib/message_buffer.cc

Issue 2064903002: Mojo: Report bindings validation errors via MojoNotifyBadMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "mojo/public/cpp/bindings/lib/message_buffer.h" 5 #include "mojo/public/cpp/bindings/lib/message_buffer.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "mojo/public/cpp/bindings/lib/serialization_util.h" 9 #include "mojo/public/cpp/bindings/lib/serialization_util.h"
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (new_bytes_claimed > data_num_bytes_) { 54 if (new_bytes_claimed > data_num_bytes_) {
55 NOTREACHED(); 55 NOTREACHED();
56 return nullptr; 56 return nullptr;
57 } 57 }
58 58
59 char* start = static_cast<char*>(buffer_) + bytes_claimed_; 59 char* start = static_cast<char*>(buffer_) + bytes_claimed_;
60 bytes_claimed_ = new_bytes_claimed; 60 bytes_claimed_ = new_bytes_claimed;
61 return static_cast<void*>(start); 61 return static_cast<void*>(start);
62 } 62 }
63 63
64 void MessageBuffer::NotifyBadMessage(const std::string& error) {
65 DCHECK(message_.is_valid());
66 MojoResult result = mojo::NotifyBadMessage(message_.get(), error);
67 DCHECK_EQ(result, MOJO_RESULT_OK);
68 }
69
64 } // namespace internal 70 } // namespace internal
65 } // namespace mojo 71 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/message_buffer.h ('k') | mojo/public/cpp/bindings/lib/message_header_validator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698