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

Side by Side Diff: util/mach/exc_server_variants.h

Issue 753563003: exc_server_variants: use DISALLOW_COPY_AND_ASSIGN (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | util/mach/exc_server_variants.cc » ('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 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #ifndef CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ 15 #ifndef CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_
16 #define CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ 16 #define CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_
17 17
18 #include <mach/mach.h> 18 #include <mach/mach.h>
19 19
20 #include "build/build_config.h"
20 #include "util/mach/mach_message_server.h" 21 #include "util/mach/mach_message_server.h"
21 22
22 namespace crashpad { 23 namespace crashpad {
23 24
24 // Routines to provide a single unified front-end to the interfaces in 25 // Routines to provide a single unified front-end to the interfaces in
25 // <mach/exc.defs> and <mach/mach_exc.defs>. The two interfaces are identical, 26 // <mach/exc.defs> and <mach/mach_exc.defs>. The two interfaces are identical,
26 // except that the latter allows for 64-bit exception codes, and is requested by 27 // except that the latter allows for 64-bit exception codes, and is requested by
27 // setting the MACH_EXCEPTION_CODES behavior bit associated with an exception 28 // setting the MACH_EXCEPTION_CODES behavior bit associated with an exception
28 // port. 29 // port.
29 30
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 106
106 bool MachMessageServerFunction(const mach_msg_header_t* in_header, 107 bool MachMessageServerFunction(const mach_msg_header_t* in_header,
107 mach_msg_header_t* out_header, 108 mach_msg_header_t* out_header,
108 bool* destroy_complex_request) override; 109 bool* destroy_complex_request) override;
109 110
110 mach_msg_size_t MachMessageServerRequestSize() override; 111 mach_msg_size_t MachMessageServerRequestSize() override;
111 mach_msg_size_t MachMessageServerReplySize() override; 112 mach_msg_size_t MachMessageServerReplySize() override;
112 113
113 private: 114 private:
114 Interface* interface_; // weak 115 Interface* interface_; // weak
116
117 DISALLOW_COPY_AND_ASSIGN(ExcServer);
115 }; 118 };
116 119
117 //! \brief A server interface for the `mach_exc` Mach subsystem. 120 //! \brief A server interface for the `mach_exc` Mach subsystem.
118 class MachExcServer : public MachMessageServer::Interface { 121 class MachExcServer : public MachMessageServer::Interface {
119 public: 122 public:
120 //! \brief An interface that the different request messages that are a part of 123 //! \brief An interface that the different request messages that are a part of
121 //! the `mach_exc` Mach subsystem can be dispatched to. 124 //! the `mach_exc` Mach subsystem can be dispatched to.
122 class Interface { 125 class Interface {
123 public: 126 public:
124 //! \brief Handles exceptions raised by `mach_exception_raise()`. 127 //! \brief Handles exceptions raised by `mach_exception_raise()`.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 195
193 bool MachMessageServerFunction(const mach_msg_header_t* in_header, 196 bool MachMessageServerFunction(const mach_msg_header_t* in_header,
194 mach_msg_header_t* out_header, 197 mach_msg_header_t* out_header,
195 bool* destroy_complex_request) override; 198 bool* destroy_complex_request) override;
196 199
197 mach_msg_size_t MachMessageServerRequestSize() override; 200 mach_msg_size_t MachMessageServerRequestSize() override;
198 mach_msg_size_t MachMessageServerReplySize() override; 201 mach_msg_size_t MachMessageServerReplySize() override;
199 202
200 private: 203 private:
201 Interface* interface_; // weak 204 Interface* interface_; // weak
205
206 DISALLOW_COPY_AND_ASSIGN(MachExcServer);
202 }; 207 };
203 208
204 //! \brief A server interface for the `exc` Mach subsystem, simplified to have 209 //! \brief A server interface for the `exc` Mach subsystem, simplified to have
205 //! only a single interface method needing implementation. 210 //! only a single interface method needing implementation.
206 class SimplifiedExcServer : public ExcServer, public ExcServer::Interface { 211 class SimplifiedExcServer : public ExcServer, public ExcServer::Interface {
207 public: 212 public:
208 //! \brief An interface that the different request messages that are a part of 213 //! \brief An interface that the different request messages that are a part of
209 //! the `exc` Mach subsystem can be dispatched to. 214 //! the `exc` Mach subsystem can be dispatched to.
210 class Interface { 215 class Interface {
211 public: 216 public:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 mach_msg_type_number_t code_count, 278 mach_msg_type_number_t code_count,
274 thread_state_flavor_t* flavor, 279 thread_state_flavor_t* flavor,
275 const natural_t* old_state, 280 const natural_t* old_state,
276 mach_msg_type_number_t old_state_count, 281 mach_msg_type_number_t old_state_count,
277 thread_state_t new_state, 282 thread_state_t new_state,
278 mach_msg_type_number_t* new_state_count, 283 mach_msg_type_number_t* new_state_count,
279 bool* destroy_request) override; 284 bool* destroy_request) override;
280 285
281 private: 286 private:
282 Interface* interface_; // weak 287 Interface* interface_; // weak
288
289 DISALLOW_COPY_AND_ASSIGN(SimplifiedExcServer);
283 }; 290 };
284 291
285 //! \brief A server interface for the `mach_exc` Mach subsystem, simplified to 292 //! \brief A server interface for the `mach_exc` Mach subsystem, simplified to
286 //! have only a single interface method needing implementation. 293 //! have only a single interface method needing implementation.
287 class SimplifiedMachExcServer : public MachExcServer, 294 class SimplifiedMachExcServer : public MachExcServer,
288 public MachExcServer::Interface { 295 public MachExcServer::Interface {
289 public: 296 public:
290 //! \brief An interface that the different request messages that are a part of 297 //! \brief An interface that the different request messages that are a part of
291 //! the `mach_exc` Mach subsystem can be dispatched to. 298 //! the `mach_exc` Mach subsystem can be dispatched to.
292 class Interface { 299 class Interface {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 mach_msg_type_number_t code_count, 371 mach_msg_type_number_t code_count,
365 thread_state_flavor_t* flavor, 372 thread_state_flavor_t* flavor,
366 const natural_t* old_state, 373 const natural_t* old_state,
367 mach_msg_type_number_t old_state_count, 374 mach_msg_type_number_t old_state_count,
368 thread_state_t new_state, 375 thread_state_t new_state,
369 mach_msg_type_number_t* new_state_count, 376 mach_msg_type_number_t* new_state_count,
370 bool* destroy_request) override; 377 bool* destroy_request) override;
371 378
372 private: 379 private:
373 Interface* interface_; // weak 380 Interface* interface_; // weak
381
382 DISALLOW_COPY_AND_ASSIGN(SimplifiedMachExcServer);
374 }; 383 };
375 384
376 } // namespace internal 385 } // namespace internal
377 386
378 //! \brief A server interface for the `exc` and `mach_exc` Mach subsystems, 387 //! \brief A server interface for the `exc` and `mach_exc` Mach subsystems,
379 //! unified to handle exceptions delivered to either subsystem, and 388 //! unified to handle exceptions delivered to either subsystem, and
380 //! simplified to have only a single interface method needing 389 //! simplified to have only a single interface method needing
381 //! implementation. 390 //! implementation.
382 //! 391 //!
383 //! UniversalMachExcServer operates by translating messages received in the 392 //! UniversalMachExcServer operates by translating messages received in the
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 thread_state_flavor_t* flavor, 425 thread_state_flavor_t* flavor,
417 const natural_t* old_state, 426 const natural_t* old_state,
418 mach_msg_type_number_t old_state_count, 427 mach_msg_type_number_t old_state_count,
419 thread_state_t new_state, 428 thread_state_t new_state,
420 mach_msg_type_number_t* new_state_count, 429 mach_msg_type_number_t* new_state_count,
421 bool* destroy_complex_request) override; 430 bool* destroy_complex_request) override;
422 431
423 private: 432 private:
424 internal::SimplifiedExcServer exc_server_; 433 internal::SimplifiedExcServer exc_server_;
425 internal::SimplifiedMachExcServer mach_exc_server_; 434 internal::SimplifiedMachExcServer mach_exc_server_;
435
436 DISALLOW_COPY_AND_ASSIGN(UniversalMachExcServer);
426 }; 437 };
427 438
428 //! \brief Recovers the original exception, first exception code, and signal 439 //! \brief Recovers the original exception, first exception code, and signal
429 //! from the encoded form of the first exception code delivered with 440 //! from the encoded form of the first exception code delivered with
430 //! `EXC_CRASH` exceptions. 441 //! `EXC_CRASH` exceptions.
431 //! 442 //!
432 //! `EXC_CRASH` exceptions are generated when the kernel has committed to 443 //! `EXC_CRASH` exceptions are generated when the kernel has committed to
433 //! terminating a process as a result of a core-generating POSIX signal and, for 444 //! terminating a process as a result of a core-generating POSIX signal and, for
434 //! hardware exceptions, an earlier Mach exception. Information about this 445 //! hardware exceptions, an earlier Mach exception. Information about this
435 //! earlier exception and signal is made available to the `EXC_CRASH` handler 446 //! earlier exception and signal is made available to the `EXC_CRASH` handler
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 //! \a behavior is not a state-carrying behavior, or when it is a 516 //! \a behavior is not a state-carrying behavior, or when it is a
506 //! state-carrying behavior and \a set_thread_state is `true`. 517 //! state-carrying behavior and \a set_thread_state is `true`.
507 //! `MACH_RCV_PORT_DIED` is used when \a behavior is a state-carrying 518 //! `MACH_RCV_PORT_DIED` is used when \a behavior is a state-carrying
508 //! behavior and \a set_thread_state is `false`. 519 //! behavior and \a set_thread_state is `false`.
509 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior, 520 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior,
510 bool set_thread_state); 521 bool set_thread_state);
511 522
512 } // namespace crashpad 523 } // namespace crashpad
513 524
514 #endif // CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ 525 #endif // CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_
OLDNEW
« no previous file with comments | « no previous file | util/mach/exc_server_variants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698