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

Side by Side Diff: ipc/ipc_message.cc

Issue 283313002: Ensure that any IPC sent from a child process that couldn't be deserialized causes that p… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: switch to histograms 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
« no previous file with comments | « ipc/ipc_message.h ('k') | ipc/ipc_message_macros.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ipc/ipc_message.h" 5 #include "ipc/ipc_message.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 Message::Message() 42 Message::Message()
43 : Pickle(sizeof(Header)) { 43 : Pickle(sizeof(Header)) {
44 header()->routing = header()->type = 0; 44 header()->routing = header()->type = 0;
45 header()->flags = GetRefNumUpper24(); 45 header()->flags = GetRefNumUpper24();
46 #if defined(OS_POSIX) 46 #if defined(OS_POSIX)
47 header()->num_fds = 0; 47 header()->num_fds = 0;
48 header()->pad = 0; 48 header()->pad = 0;
49 #endif 49 #endif
50 InitLoggingVariables(); 50 Init();
51 } 51 }
52 52
53 Message::Message(int32 routing_id, uint32 type, PriorityValue priority) 53 Message::Message(int32 routing_id, uint32 type, PriorityValue priority)
54 : Pickle(sizeof(Header)) { 54 : Pickle(sizeof(Header)) {
55 header()->routing = routing_id; 55 header()->routing = routing_id;
56 header()->type = type; 56 header()->type = type;
57 DCHECK((priority & 0xffffff00) == 0); 57 DCHECK((priority & 0xffffff00) == 0);
58 header()->flags = priority | GetRefNumUpper24(); 58 header()->flags = priority | GetRefNumUpper24();
59 #if defined(OS_POSIX) 59 #if defined(OS_POSIX)
60 header()->num_fds = 0; 60 header()->num_fds = 0;
61 header()->pad = 0; 61 header()->pad = 0;
62 #endif 62 #endif
63 InitLoggingVariables(); 63 Init();
64 } 64 }
65 65
66 Message::Message(const char* data, int data_len) : Pickle(data, data_len) { 66 Message::Message(const char* data, int data_len) : Pickle(data, data_len) {
67 InitLoggingVariables(); 67 Init();
68 } 68 }
69 69
70 Message::Message(const Message& other) : Pickle(other) { 70 Message::Message(const Message& other) : Pickle(other) {
71 InitLoggingVariables(); 71 Init();
72 #if defined(OS_POSIX) 72 #if defined(OS_POSIX)
73 file_descriptor_set_ = other.file_descriptor_set_; 73 file_descriptor_set_ = other.file_descriptor_set_;
74 #endif 74 #endif
75 } 75 }
76 76
77 void Message::InitLoggingVariables() { 77 void Message::Init() {
78 dispatch_error_ = false;
78 #ifdef IPC_MESSAGE_LOG_ENABLED 79 #ifdef IPC_MESSAGE_LOG_ENABLED
79 received_time_ = 0; 80 received_time_ = 0;
80 dont_log_ = false; 81 dont_log_ = false;
81 log_data_ = NULL; 82 log_data_ = NULL;
82 #endif 83 #endif
83 } 84 }
84 85
85 Message& Message::operator=(const Message& other) { 86 Message& Message::operator=(const Message& other) {
86 *static_cast<Pickle*>(this) = other; 87 *static_cast<Pickle*>(this) = other;
87 #if defined(OS_POSIX) 88 #if defined(OS_POSIX)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 154 }
154 155
155 void Message::EnsureFileDescriptorSet() { 156 void Message::EnsureFileDescriptorSet() {
156 if (file_descriptor_set_.get() == NULL) 157 if (file_descriptor_set_.get() == NULL)
157 file_descriptor_set_ = new FileDescriptorSet; 158 file_descriptor_set_ = new FileDescriptorSet;
158 } 159 }
159 160
160 #endif 161 #endif
161 162
162 } // namespace IPC 163 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_message.h ('k') | ipc/ipc_message_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698