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

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

Issue 289333002: Mojo cpp bindings: validation logic for incoming messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/message.h" 5 #include "mojo/public/cpp/bindings/message.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 11
12 #include "mojo/public/cpp/bindings/lib/message_header_validator.h"
13
14 namespace mojo { 12 namespace mojo {
15 13
16 Message::Message() 14 Message::Message()
17 : data_num_bytes_(0), 15 : data_num_bytes_(0),
18 data_(NULL) { 16 data_(NULL) {
19 } 17 }
20 18
21 Message::~Message() { 19 Message::~Message() {
22 free(data_); 20 free(data_);
23 21
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 65
68 rv = ReadMessageRaw(handle, 66 rv = ReadMessageRaw(handle,
69 message.mutable_data(), 67 message.mutable_data(),
70 &num_bytes, 68 &num_bytes,
71 message.mutable_handles()->empty() 69 message.mutable_handles()->empty()
72 ? NULL 70 ? NULL
73 : reinterpret_cast<MojoHandle*>( 71 : reinterpret_cast<MojoHandle*>(
74 &message.mutable_handles()->front()), 72 &message.mutable_handles()->front()),
75 &num_handles, 73 &num_handles,
76 MOJO_READ_MESSAGE_FLAG_NONE); 74 MOJO_READ_MESSAGE_FLAG_NONE);
77 if (receiver && rv == MOJO_RESULT_OK) { 75 if (receiver && rv == MOJO_RESULT_OK)
78 *receiver_result = 76 *receiver_result = receiver->Accept(&message);
79 internal::MessageHeaderValidator(receiver).Accept(&message);
80 }
81 77
82 return rv; 78 return rv;
83 } 79 }
84 80
85 } // namespace mojo 81 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698