OLD | NEW |
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_sync_channel.h" | 5 #include "ipc/ipc_sync_channel.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 channel_created_(new WaitableEvent(false, false)), | 51 channel_created_(new WaitableEvent(false, false)), |
52 channel_name_(channel_name), | 52 channel_name_(channel_name), |
53 mode_(mode), | 53 mode_(mode), |
54 ipc_thread_((channel_name + "_ipc").c_str()), | 54 ipc_thread_((channel_name + "_ipc").c_str()), |
55 listener_thread_((channel_name + "_listener").c_str()), | 55 listener_thread_((channel_name + "_listener").c_str()), |
56 overrided_thread_(NULL), | 56 overrided_thread_(NULL), |
57 shutdown_event_(true, false), | 57 shutdown_event_(true, false), |
58 is_shutdown_(false) { | 58 is_shutdown_(false) { |
59 } | 59 } |
60 | 60 |
61 ~Worker() override { | 61 virtual ~Worker() { |
62 // Shutdown() must be called before destruction. | 62 // Shutdown() must be called before destruction. |
63 CHECK(is_shutdown_); | 63 CHECK(is_shutdown_); |
64 } | 64 } |
65 void AddRef() { } | 65 void AddRef() { } |
66 void Release() { } | 66 void Release() { } |
67 bool Send(Message* msg) override { return channel_->Send(msg); } | 67 virtual bool Send(Message* msg) override { return channel_->Send(msg); } |
68 void WaitForChannelCreation() { channel_created_->Wait(); } | 68 void WaitForChannelCreation() { channel_created_->Wait(); } |
69 void CloseChannel() { | 69 void CloseChannel() { |
70 DCHECK(base::MessageLoop::current() == ListenerThread()->message_loop()); | 70 DCHECK(base::MessageLoop::current() == ListenerThread()->message_loop()); |
71 channel_->Close(); | 71 channel_->Close(); |
72 } | 72 } |
73 void Start() { | 73 void Start() { |
74 StartThread(&listener_thread_, base::MessageLoop::TYPE_DEFAULT); | 74 StartThread(&listener_thread_, base::MessageLoop::TYPE_DEFAULT); |
75 ListenerThread()->message_loop()->PostTask( | 75 ListenerThread()->message_loop()->PostTask( |
76 FROM_HERE, base::Bind(&Worker::OnStart, this)); | 76 FROM_HERE, base::Bind(&Worker::OnStart, this)); |
77 } | 77 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 listener_thread_.message_loop()->PostTask( | 193 listener_thread_.message_loop()->PostTask( |
194 FROM_HERE, base::Bind(&Worker::OnListenerThreadShutdown2, this, | 194 FROM_HERE, base::Bind(&Worker::OnListenerThreadShutdown2, this, |
195 listener_event)); | 195 listener_event)); |
196 } | 196 } |
197 | 197 |
198 void OnListenerThreadShutdown2(WaitableEvent* listener_event) { | 198 void OnListenerThreadShutdown2(WaitableEvent* listener_event) { |
199 base::RunLoop().RunUntilIdle(); | 199 base::RunLoop().RunUntilIdle(); |
200 listener_event->Signal(); | 200 listener_event->Signal(); |
201 } | 201 } |
202 | 202 |
203 bool OnMessageReceived(const Message& message) override { | 203 virtual bool OnMessageReceived(const Message& message) override { |
204 IPC_BEGIN_MESSAGE_MAP(Worker, message) | 204 IPC_BEGIN_MESSAGE_MAP(Worker, message) |
205 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_Double, OnDoubleDelay) | 205 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_Double, OnDoubleDelay) |
206 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_AnswerToLife, | 206 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_AnswerToLife, |
207 OnAnswerDelay) | 207 OnAnswerDelay) |
208 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelNestedTestMsg_String, | 208 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelNestedTestMsg_String, |
209 OnNestedTestMsg) | 209 OnNestedTestMsg) |
210 IPC_END_MESSAGE_MAP() | 210 IPC_END_MESSAGE_MAP() |
211 return true; | 211 return true; |
212 } | 212 } |
213 | 213 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 base::MessageLoop message_loop_; | 267 base::MessageLoop message_loop_; |
268 }; | 268 }; |
269 | 269 |
270 //------------------------------------------------------------------------------ | 270 //------------------------------------------------------------------------------ |
271 | 271 |
272 class SimpleServer : public Worker { | 272 class SimpleServer : public Worker { |
273 public: | 273 public: |
274 explicit SimpleServer(bool pump_during_send) | 274 explicit SimpleServer(bool pump_during_send) |
275 : Worker(Channel::MODE_SERVER, "simpler_server"), | 275 : Worker(Channel::MODE_SERVER, "simpler_server"), |
276 pump_during_send_(pump_during_send) { } | 276 pump_during_send_(pump_during_send) { } |
277 void Run() override { | 277 virtual void Run() override { |
278 SendAnswerToLife(pump_during_send_, true); | 278 SendAnswerToLife(pump_during_send_, true); |
279 Done(); | 279 Done(); |
280 } | 280 } |
281 | 281 |
282 bool pump_during_send_; | 282 bool pump_during_send_; |
283 }; | 283 }; |
284 | 284 |
285 class SimpleClient : public Worker { | 285 class SimpleClient : public Worker { |
286 public: | 286 public: |
287 SimpleClient() : Worker(Channel::MODE_CLIENT, "simple_client") { } | 287 SimpleClient() : Worker(Channel::MODE_CLIENT, "simple_client") { } |
288 | 288 |
289 void OnAnswer(int* answer) override { | 289 virtual void OnAnswer(int* answer) override { |
290 *answer = 42; | 290 *answer = 42; |
291 Done(); | 291 Done(); |
292 } | 292 } |
293 }; | 293 }; |
294 | 294 |
295 void Simple(bool pump_during_send) { | 295 void Simple(bool pump_during_send) { |
296 std::vector<Worker*> workers; | 296 std::vector<Worker*> workers; |
297 workers.push_back(new SimpleServer(pump_during_send)); | 297 workers.push_back(new SimpleServer(pump_during_send)); |
298 workers.push_back(new SimpleClient()); | 298 workers.push_back(new SimpleClient()); |
299 RunTest(workers); | 299 RunTest(workers); |
300 } | 300 } |
301 | 301 |
302 // Tests basic synchronous call | 302 // Tests basic synchronous call |
303 TEST_F(IPCSyncChannelTest, Simple) { | 303 TEST_F(IPCSyncChannelTest, Simple) { |
304 Simple(false); | 304 Simple(false); |
305 Simple(true); | 305 Simple(true); |
306 } | 306 } |
307 | 307 |
308 //------------------------------------------------------------------------------ | 308 //------------------------------------------------------------------------------ |
309 | 309 |
310 // Worker classes which override how the sync channel is created to use the | 310 // Worker classes which override how the sync channel is created to use the |
311 // two-step initialization (calling the lightweight constructor and then | 311 // two-step initialization (calling the lightweight constructor and then |
312 // ChannelProxy::Init separately) process. | 312 // ChannelProxy::Init separately) process. |
313 class TwoStepServer : public Worker { | 313 class TwoStepServer : public Worker { |
314 public: | 314 public: |
315 explicit TwoStepServer(bool create_pipe_now) | 315 explicit TwoStepServer(bool create_pipe_now) |
316 : Worker(Channel::MODE_SERVER, "simpler_server"), | 316 : Worker(Channel::MODE_SERVER, "simpler_server"), |
317 create_pipe_now_(create_pipe_now) { } | 317 create_pipe_now_(create_pipe_now) { } |
318 | 318 |
319 void Run() override { | 319 virtual void Run() override { |
320 SendAnswerToLife(false, true); | 320 SendAnswerToLife(false, true); |
321 Done(); | 321 Done(); |
322 } | 322 } |
323 | 323 |
324 SyncChannel* CreateChannel() override { | 324 virtual SyncChannel* CreateChannel() override { |
325 SyncChannel* channel = | 325 SyncChannel* channel = |
326 SyncChannel::Create(channel_name(), mode(), this, | 326 SyncChannel::Create(channel_name(), mode(), this, |
327 ipc_thread().message_loop_proxy().get(), | 327 ipc_thread().message_loop_proxy().get(), |
328 create_pipe_now_, | 328 create_pipe_now_, |
329 shutdown_event()).release(); | 329 shutdown_event()).release(); |
330 return channel; | 330 return channel; |
331 } | 331 } |
332 | 332 |
333 bool create_pipe_now_; | 333 bool create_pipe_now_; |
334 }; | 334 }; |
335 | 335 |
336 class TwoStepClient : public Worker { | 336 class TwoStepClient : public Worker { |
337 public: | 337 public: |
338 TwoStepClient(bool create_pipe_now) | 338 TwoStepClient(bool create_pipe_now) |
339 : Worker(Channel::MODE_CLIENT, "simple_client"), | 339 : Worker(Channel::MODE_CLIENT, "simple_client"), |
340 create_pipe_now_(create_pipe_now) { } | 340 create_pipe_now_(create_pipe_now) { } |
341 | 341 |
342 void OnAnswer(int* answer) override { | 342 virtual void OnAnswer(int* answer) override { |
343 *answer = 42; | 343 *answer = 42; |
344 Done(); | 344 Done(); |
345 } | 345 } |
346 | 346 |
347 SyncChannel* CreateChannel() override { | 347 virtual SyncChannel* CreateChannel() override { |
348 SyncChannel* channel = | 348 SyncChannel* channel = |
349 SyncChannel::Create(channel_name(), mode(), this, | 349 SyncChannel::Create(channel_name(), mode(), this, |
350 ipc_thread().message_loop_proxy().get(), | 350 ipc_thread().message_loop_proxy().get(), |
351 create_pipe_now_, | 351 create_pipe_now_, |
352 shutdown_event()).release(); | 352 shutdown_event()).release(); |
353 return channel; | 353 return channel; |
354 } | 354 } |
355 | 355 |
356 bool create_pipe_now_; | 356 bool create_pipe_now_; |
357 }; | 357 }; |
(...skipping 13 matching lines...) Expand all Loading... |
371 TwoStep(true, false); | 371 TwoStep(true, false); |
372 TwoStep(true, true); | 372 TwoStep(true, true); |
373 } | 373 } |
374 | 374 |
375 //------------------------------------------------------------------------------ | 375 //------------------------------------------------------------------------------ |
376 | 376 |
377 class DelayClient : public Worker { | 377 class DelayClient : public Worker { |
378 public: | 378 public: |
379 DelayClient() : Worker(Channel::MODE_CLIENT, "delay_client") { } | 379 DelayClient() : Worker(Channel::MODE_CLIENT, "delay_client") { } |
380 | 380 |
381 void OnAnswerDelay(Message* reply_msg) override { | 381 virtual void OnAnswerDelay(Message* reply_msg) override { |
382 SyncChannelTestMsg_AnswerToLife::WriteReplyParams(reply_msg, 42); | 382 SyncChannelTestMsg_AnswerToLife::WriteReplyParams(reply_msg, 42); |
383 Send(reply_msg); | 383 Send(reply_msg); |
384 Done(); | 384 Done(); |
385 } | 385 } |
386 }; | 386 }; |
387 | 387 |
388 void DelayReply(bool pump_during_send) { | 388 void DelayReply(bool pump_during_send) { |
389 std::vector<Worker*> workers; | 389 std::vector<Worker*> workers; |
390 workers.push_back(new SimpleServer(pump_during_send)); | 390 workers.push_back(new SimpleServer(pump_during_send)); |
391 workers.push_back(new DelayClient()); | 391 workers.push_back(new DelayClient()); |
392 RunTest(workers); | 392 RunTest(workers); |
393 } | 393 } |
394 | 394 |
395 // Tests that asynchronous replies work | 395 // Tests that asynchronous replies work |
396 TEST_F(IPCSyncChannelTest, DelayReply) { | 396 TEST_F(IPCSyncChannelTest, DelayReply) { |
397 DelayReply(false); | 397 DelayReply(false); |
398 DelayReply(true); | 398 DelayReply(true); |
399 } | 399 } |
400 | 400 |
401 //------------------------------------------------------------------------------ | 401 //------------------------------------------------------------------------------ |
402 | 402 |
403 class NoHangServer : public Worker { | 403 class NoHangServer : public Worker { |
404 public: | 404 public: |
405 NoHangServer(WaitableEvent* got_first_reply, bool pump_during_send) | 405 NoHangServer(WaitableEvent* got_first_reply, bool pump_during_send) |
406 : Worker(Channel::MODE_SERVER, "no_hang_server"), | 406 : Worker(Channel::MODE_SERVER, "no_hang_server"), |
407 got_first_reply_(got_first_reply), | 407 got_first_reply_(got_first_reply), |
408 pump_during_send_(pump_during_send) { } | 408 pump_during_send_(pump_during_send) { } |
409 void Run() override { | 409 virtual void Run() override { |
410 SendAnswerToLife(pump_during_send_, true); | 410 SendAnswerToLife(pump_during_send_, true); |
411 got_first_reply_->Signal(); | 411 got_first_reply_->Signal(); |
412 | 412 |
413 SendAnswerToLife(pump_during_send_, false); | 413 SendAnswerToLife(pump_during_send_, false); |
414 Done(); | 414 Done(); |
415 } | 415 } |
416 | 416 |
417 WaitableEvent* got_first_reply_; | 417 WaitableEvent* got_first_reply_; |
418 bool pump_during_send_; | 418 bool pump_during_send_; |
419 }; | 419 }; |
420 | 420 |
421 class NoHangClient : public Worker { | 421 class NoHangClient : public Worker { |
422 public: | 422 public: |
423 explicit NoHangClient(WaitableEvent* got_first_reply) | 423 explicit NoHangClient(WaitableEvent* got_first_reply) |
424 : Worker(Channel::MODE_CLIENT, "no_hang_client"), | 424 : Worker(Channel::MODE_CLIENT, "no_hang_client"), |
425 got_first_reply_(got_first_reply) { } | 425 got_first_reply_(got_first_reply) { } |
426 | 426 |
427 void OnAnswerDelay(Message* reply_msg) override { | 427 virtual void OnAnswerDelay(Message* reply_msg) override { |
428 // Use the DELAY_REPLY macro so that we can force the reply to be sent | 428 // Use the DELAY_REPLY macro so that we can force the reply to be sent |
429 // before this function returns (when the channel will be reset). | 429 // before this function returns (when the channel will be reset). |
430 SyncChannelTestMsg_AnswerToLife::WriteReplyParams(reply_msg, 42); | 430 SyncChannelTestMsg_AnswerToLife::WriteReplyParams(reply_msg, 42); |
431 Send(reply_msg); | 431 Send(reply_msg); |
432 got_first_reply_->Wait(); | 432 got_first_reply_->Wait(); |
433 CloseChannel(); | 433 CloseChannel(); |
434 Done(); | 434 Done(); |
435 } | 435 } |
436 | 436 |
437 WaitableEvent* got_first_reply_; | 437 WaitableEvent* got_first_reply_; |
(...skipping 14 matching lines...) Expand all Loading... |
452 } | 452 } |
453 | 453 |
454 //------------------------------------------------------------------------------ | 454 //------------------------------------------------------------------------------ |
455 | 455 |
456 class UnblockServer : public Worker { | 456 class UnblockServer : public Worker { |
457 public: | 457 public: |
458 UnblockServer(bool pump_during_send, bool delete_during_send) | 458 UnblockServer(bool pump_during_send, bool delete_during_send) |
459 : Worker(Channel::MODE_SERVER, "unblock_server"), | 459 : Worker(Channel::MODE_SERVER, "unblock_server"), |
460 pump_during_send_(pump_during_send), | 460 pump_during_send_(pump_during_send), |
461 delete_during_send_(delete_during_send) { } | 461 delete_during_send_(delete_during_send) { } |
462 void Run() override { | 462 virtual void Run() override { |
463 if (delete_during_send_) { | 463 if (delete_during_send_) { |
464 // Use custom code since race conditions mean the answer may or may not be | 464 // Use custom code since race conditions mean the answer may or may not be |
465 // available. | 465 // available. |
466 int answer = 0; | 466 int answer = 0; |
467 SyncMessage* msg = new SyncChannelTestMsg_AnswerToLife(&answer); | 467 SyncMessage* msg = new SyncChannelTestMsg_AnswerToLife(&answer); |
468 if (pump_during_send_) | 468 if (pump_during_send_) |
469 msg->EnableMessagePumping(); | 469 msg->EnableMessagePumping(); |
470 Send(msg); | 470 Send(msg); |
471 } else { | 471 } else { |
472 SendAnswerToLife(pump_during_send_, true); | 472 SendAnswerToLife(pump_during_send_, true); |
473 } | 473 } |
474 Done(); | 474 Done(); |
475 } | 475 } |
476 | 476 |
477 void OnDoubleDelay(int in, Message* reply_msg) override { | 477 virtual void OnDoubleDelay(int in, Message* reply_msg) override { |
478 SyncChannelTestMsg_Double::WriteReplyParams(reply_msg, in * 2); | 478 SyncChannelTestMsg_Double::WriteReplyParams(reply_msg, in * 2); |
479 Send(reply_msg); | 479 Send(reply_msg); |
480 if (delete_during_send_) | 480 if (delete_during_send_) |
481 ResetChannel(); | 481 ResetChannel(); |
482 } | 482 } |
483 | 483 |
484 bool pump_during_send_; | 484 bool pump_during_send_; |
485 bool delete_during_send_; | 485 bool delete_during_send_; |
486 }; | 486 }; |
487 | 487 |
488 class UnblockClient : public Worker { | 488 class UnblockClient : public Worker { |
489 public: | 489 public: |
490 explicit UnblockClient(bool pump_during_send) | 490 explicit UnblockClient(bool pump_during_send) |
491 : Worker(Channel::MODE_CLIENT, "unblock_client"), | 491 : Worker(Channel::MODE_CLIENT, "unblock_client"), |
492 pump_during_send_(pump_during_send) { } | 492 pump_during_send_(pump_during_send) { } |
493 | 493 |
494 void OnAnswer(int* answer) override { | 494 virtual void OnAnswer(int* answer) override { |
495 SendDouble(pump_during_send_, true); | 495 SendDouble(pump_during_send_, true); |
496 *answer = 42; | 496 *answer = 42; |
497 Done(); | 497 Done(); |
498 } | 498 } |
499 | 499 |
500 bool pump_during_send_; | 500 bool pump_during_send_; |
501 }; | 501 }; |
502 | 502 |
503 void Unblock(bool server_pump, bool client_pump, bool delete_during_send) { | 503 void Unblock(bool server_pump, bool client_pump, bool delete_during_send) { |
504 std::vector<Worker*> workers; | 504 std::vector<Worker*> workers; |
(...skipping 21 matching lines...) Expand all Loading... |
526 } | 526 } |
527 | 527 |
528 //------------------------------------------------------------------------------ | 528 //------------------------------------------------------------------------------ |
529 | 529 |
530 class RecursiveServer : public Worker { | 530 class RecursiveServer : public Worker { |
531 public: | 531 public: |
532 RecursiveServer(bool expected_send_result, bool pump_first, bool pump_second) | 532 RecursiveServer(bool expected_send_result, bool pump_first, bool pump_second) |
533 : Worker(Channel::MODE_SERVER, "recursive_server"), | 533 : Worker(Channel::MODE_SERVER, "recursive_server"), |
534 expected_send_result_(expected_send_result), | 534 expected_send_result_(expected_send_result), |
535 pump_first_(pump_first), pump_second_(pump_second) {} | 535 pump_first_(pump_first), pump_second_(pump_second) {} |
536 void Run() override { | 536 virtual void Run() override { |
537 SendDouble(pump_first_, expected_send_result_); | 537 SendDouble(pump_first_, expected_send_result_); |
538 Done(); | 538 Done(); |
539 } | 539 } |
540 | 540 |
541 void OnDouble(int in, int* out) override { | 541 virtual void OnDouble(int in, int* out) override { |
542 *out = in * 2; | 542 *out = in * 2; |
543 SendAnswerToLife(pump_second_, expected_send_result_); | 543 SendAnswerToLife(pump_second_, expected_send_result_); |
544 } | 544 } |
545 | 545 |
546 bool expected_send_result_, pump_first_, pump_second_; | 546 bool expected_send_result_, pump_first_, pump_second_; |
547 }; | 547 }; |
548 | 548 |
549 class RecursiveClient : public Worker { | 549 class RecursiveClient : public Worker { |
550 public: | 550 public: |
551 RecursiveClient(bool pump_during_send, bool close_channel) | 551 RecursiveClient(bool pump_during_send, bool close_channel) |
552 : Worker(Channel::MODE_CLIENT, "recursive_client"), | 552 : Worker(Channel::MODE_CLIENT, "recursive_client"), |
553 pump_during_send_(pump_during_send), close_channel_(close_channel) {} | 553 pump_during_send_(pump_during_send), close_channel_(close_channel) {} |
554 | 554 |
555 void OnDoubleDelay(int in, Message* reply_msg) override { | 555 virtual void OnDoubleDelay(int in, Message* reply_msg) override { |
556 SendDouble(pump_during_send_, !close_channel_); | 556 SendDouble(pump_during_send_, !close_channel_); |
557 if (close_channel_) { | 557 if (close_channel_) { |
558 delete reply_msg; | 558 delete reply_msg; |
559 } else { | 559 } else { |
560 SyncChannelTestMsg_Double::WriteReplyParams(reply_msg, in * 2); | 560 SyncChannelTestMsg_Double::WriteReplyParams(reply_msg, in * 2); |
561 Send(reply_msg); | 561 Send(reply_msg); |
562 } | 562 } |
563 Done(); | 563 Done(); |
564 } | 564 } |
565 | 565 |
566 void OnAnswerDelay(Message* reply_msg) override { | 566 virtual void OnAnswerDelay(Message* reply_msg) override { |
567 if (close_channel_) { | 567 if (close_channel_) { |
568 delete reply_msg; | 568 delete reply_msg; |
569 CloseChannel(); | 569 CloseChannel(); |
570 } else { | 570 } else { |
571 SyncChannelTestMsg_AnswerToLife::WriteReplyParams(reply_msg, 42); | 571 SyncChannelTestMsg_AnswerToLife::WriteReplyParams(reply_msg, 42); |
572 Send(reply_msg); | 572 Send(reply_msg); |
573 } | 573 } |
574 } | 574 } |
575 | 575 |
576 bool pump_during_send_, close_channel_; | 576 bool pump_during_send_, close_channel_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 } | 622 } |
623 | 623 |
624 //------------------------------------------------------------------------------ | 624 //------------------------------------------------------------------------------ |
625 | 625 |
626 class MultipleServer1 : public Worker { | 626 class MultipleServer1 : public Worker { |
627 public: | 627 public: |
628 explicit MultipleServer1(bool pump_during_send) | 628 explicit MultipleServer1(bool pump_during_send) |
629 : Worker("test_channel1", Channel::MODE_SERVER), | 629 : Worker("test_channel1", Channel::MODE_SERVER), |
630 pump_during_send_(pump_during_send) { } | 630 pump_during_send_(pump_during_send) { } |
631 | 631 |
632 void Run() override { | 632 virtual void Run() override { |
633 SendDouble(pump_during_send_, true); | 633 SendDouble(pump_during_send_, true); |
634 Done(); | 634 Done(); |
635 } | 635 } |
636 | 636 |
637 bool pump_during_send_; | 637 bool pump_during_send_; |
638 }; | 638 }; |
639 | 639 |
640 class MultipleClient1 : public Worker { | 640 class MultipleClient1 : public Worker { |
641 public: | 641 public: |
642 MultipleClient1(WaitableEvent* client1_msg_received, | 642 MultipleClient1(WaitableEvent* client1_msg_received, |
643 WaitableEvent* client1_can_reply) : | 643 WaitableEvent* client1_can_reply) : |
644 Worker("test_channel1", Channel::MODE_CLIENT), | 644 Worker("test_channel1", Channel::MODE_CLIENT), |
645 client1_msg_received_(client1_msg_received), | 645 client1_msg_received_(client1_msg_received), |
646 client1_can_reply_(client1_can_reply) { } | 646 client1_can_reply_(client1_can_reply) { } |
647 | 647 |
648 void OnDouble(int in, int* out) override { | 648 virtual void OnDouble(int in, int* out) override { |
649 client1_msg_received_->Signal(); | 649 client1_msg_received_->Signal(); |
650 *out = in * 2; | 650 *out = in * 2; |
651 client1_can_reply_->Wait(); | 651 client1_can_reply_->Wait(); |
652 Done(); | 652 Done(); |
653 } | 653 } |
654 | 654 |
655 private: | 655 private: |
656 WaitableEvent *client1_msg_received_, *client1_can_reply_; | 656 WaitableEvent *client1_msg_received_, *client1_can_reply_; |
657 }; | 657 }; |
658 | 658 |
659 class MultipleServer2 : public Worker { | 659 class MultipleServer2 : public Worker { |
660 public: | 660 public: |
661 MultipleServer2() : Worker("test_channel2", Channel::MODE_SERVER) { } | 661 MultipleServer2() : Worker("test_channel2", Channel::MODE_SERVER) { } |
662 | 662 |
663 void OnAnswer(int* result) override { | 663 virtual void OnAnswer(int* result) override { |
664 *result = 42; | 664 *result = 42; |
665 Done(); | 665 Done(); |
666 } | 666 } |
667 }; | 667 }; |
668 | 668 |
669 class MultipleClient2 : public Worker { | 669 class MultipleClient2 : public Worker { |
670 public: | 670 public: |
671 MultipleClient2( | 671 MultipleClient2( |
672 WaitableEvent* client1_msg_received, WaitableEvent* client1_can_reply, | 672 WaitableEvent* client1_msg_received, WaitableEvent* client1_can_reply, |
673 bool pump_during_send) | 673 bool pump_during_send) |
674 : Worker("test_channel2", Channel::MODE_CLIENT), | 674 : Worker("test_channel2", Channel::MODE_CLIENT), |
675 client1_msg_received_(client1_msg_received), | 675 client1_msg_received_(client1_msg_received), |
676 client1_can_reply_(client1_can_reply), | 676 client1_can_reply_(client1_can_reply), |
677 pump_during_send_(pump_during_send) { } | 677 pump_during_send_(pump_during_send) { } |
678 | 678 |
679 void Run() override { | 679 virtual void Run() override { |
680 client1_msg_received_->Wait(); | 680 client1_msg_received_->Wait(); |
681 SendAnswerToLife(pump_during_send_, true); | 681 SendAnswerToLife(pump_during_send_, true); |
682 client1_can_reply_->Signal(); | 682 client1_can_reply_->Signal(); |
683 Done(); | 683 Done(); |
684 } | 684 } |
685 | 685 |
686 private: | 686 private: |
687 WaitableEvent *client1_msg_received_, *client1_can_reply_; | 687 WaitableEvent *client1_msg_received_, *client1_can_reply_; |
688 bool pump_during_send_; | 688 bool pump_during_send_; |
689 }; | 689 }; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 class QueuedReplyServer : public Worker { | 739 class QueuedReplyServer : public Worker { |
740 public: | 740 public: |
741 QueuedReplyServer(base::Thread* listener_thread, | 741 QueuedReplyServer(base::Thread* listener_thread, |
742 const std::string& channel_name, | 742 const std::string& channel_name, |
743 const std::string& reply_text) | 743 const std::string& reply_text) |
744 : Worker(channel_name, Channel::MODE_SERVER), | 744 : Worker(channel_name, Channel::MODE_SERVER), |
745 reply_text_(reply_text) { | 745 reply_text_(reply_text) { |
746 Worker::OverrideThread(listener_thread); | 746 Worker::OverrideThread(listener_thread); |
747 } | 747 } |
748 | 748 |
749 void OnNestedTestMsg(Message* reply_msg) override { | 749 virtual void OnNestedTestMsg(Message* reply_msg) override { |
750 VLOG(1) << __FUNCTION__ << " Sending reply: " << reply_text_; | 750 VLOG(1) << __FUNCTION__ << " Sending reply: " << reply_text_; |
751 SyncChannelNestedTestMsg_String::WriteReplyParams(reply_msg, reply_text_); | 751 SyncChannelNestedTestMsg_String::WriteReplyParams(reply_msg, reply_text_); |
752 Send(reply_msg); | 752 Send(reply_msg); |
753 Done(); | 753 Done(); |
754 } | 754 } |
755 | 755 |
756 private: | 756 private: |
757 std::string reply_text_; | 757 std::string reply_text_; |
758 }; | 758 }; |
759 | 759 |
760 // The QueuedReplyClient class provides functionality to test the case where | 760 // The QueuedReplyClient class provides functionality to test the case where |
761 // multiple sync channels are in use on the same thread and they make nested | 761 // multiple sync channels are in use on the same thread and they make nested |
762 // sync calls, i.e. while the first channel waits for a response it makes a | 762 // sync calls, i.e. while the first channel waits for a response it makes a |
763 // sync call on another channel. | 763 // sync call on another channel. |
764 // The callstack should unwind correctly, i.e. the outermost call should | 764 // The callstack should unwind correctly, i.e. the outermost call should |
765 // complete first, and so on. | 765 // complete first, and so on. |
766 class QueuedReplyClient : public Worker { | 766 class QueuedReplyClient : public Worker { |
767 public: | 767 public: |
768 QueuedReplyClient(base::Thread* listener_thread, | 768 QueuedReplyClient(base::Thread* listener_thread, |
769 const std::string& channel_name, | 769 const std::string& channel_name, |
770 const std::string& expected_text, | 770 const std::string& expected_text, |
771 bool pump_during_send) | 771 bool pump_during_send) |
772 : Worker(channel_name, Channel::MODE_CLIENT), | 772 : Worker(channel_name, Channel::MODE_CLIENT), |
773 pump_during_send_(pump_during_send), | 773 pump_during_send_(pump_during_send), |
774 expected_text_(expected_text) { | 774 expected_text_(expected_text) { |
775 Worker::OverrideThread(listener_thread); | 775 Worker::OverrideThread(listener_thread); |
776 } | 776 } |
777 | 777 |
778 void Run() override { | 778 virtual void Run() override { |
779 std::string response; | 779 std::string response; |
780 SyncMessage* msg = new SyncChannelNestedTestMsg_String(&response); | 780 SyncMessage* msg = new SyncChannelNestedTestMsg_String(&response); |
781 if (pump_during_send_) | 781 if (pump_during_send_) |
782 msg->EnableMessagePumping(); | 782 msg->EnableMessagePumping(); |
783 bool result = Send(msg); | 783 bool result = Send(msg); |
784 DCHECK(result); | 784 DCHECK(result); |
785 DCHECK_EQ(response, expected_text_); | 785 DCHECK_EQ(response, expected_text_); |
786 | 786 |
787 VLOG(1) << __FUNCTION__ << " Received reply: " << response; | 787 VLOG(1) << __FUNCTION__ << " Received reply: " << response; |
788 Done(); | 788 Done(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 QueuedReply(true); | 841 QueuedReply(true); |
842 } | 842 } |
843 | 843 |
844 //------------------------------------------------------------------------------ | 844 //------------------------------------------------------------------------------ |
845 | 845 |
846 class ChattyClient : public Worker { | 846 class ChattyClient : public Worker { |
847 public: | 847 public: |
848 ChattyClient() : | 848 ChattyClient() : |
849 Worker(Channel::MODE_CLIENT, "chatty_client") { } | 849 Worker(Channel::MODE_CLIENT, "chatty_client") { } |
850 | 850 |
851 void OnAnswer(int* answer) override { | 851 virtual void OnAnswer(int* answer) override { |
852 // The PostMessage limit is 10k. Send 20% more than that. | 852 // The PostMessage limit is 10k. Send 20% more than that. |
853 const int kMessageLimit = 10000; | 853 const int kMessageLimit = 10000; |
854 const int kMessagesToSend = kMessageLimit * 120 / 100; | 854 const int kMessagesToSend = kMessageLimit * 120 / 100; |
855 for (int i = 0; i < kMessagesToSend; ++i) { | 855 for (int i = 0; i < kMessagesToSend; ++i) { |
856 if (!SendDouble(false, true)) | 856 if (!SendDouble(false, true)) |
857 break; | 857 break; |
858 } | 858 } |
859 *answer = 42; | 859 *answer = 42; |
860 Done(); | 860 Done(); |
861 } | 861 } |
(...skipping 26 matching lines...) Expand all Loading... |
888 | 888 |
889 void TimeoutCallback() { | 889 void TimeoutCallback() { |
890 timeout_occurred = true; | 890 timeout_occurred = true; |
891 } | 891 } |
892 | 892 |
893 class DoneEventRaceServer : public Worker { | 893 class DoneEventRaceServer : public Worker { |
894 public: | 894 public: |
895 DoneEventRaceServer() | 895 DoneEventRaceServer() |
896 : Worker(Channel::MODE_SERVER, "done_event_race_server") { } | 896 : Worker(Channel::MODE_SERVER, "done_event_race_server") { } |
897 | 897 |
898 void Run() override { | 898 virtual void Run() override { |
899 base::MessageLoop::current()->PostTask(FROM_HERE, | 899 base::MessageLoop::current()->PostTask(FROM_HERE, |
900 base::Bind(&NestedCallback, this)); | 900 base::Bind(&NestedCallback, this)); |
901 base::MessageLoop::current()->PostDelayedTask( | 901 base::MessageLoop::current()->PostDelayedTask( |
902 FROM_HERE, | 902 FROM_HERE, |
903 base::Bind(&TimeoutCallback), | 903 base::Bind(&TimeoutCallback), |
904 base::TimeDelta::FromSeconds(9)); | 904 base::TimeDelta::FromSeconds(9)); |
905 // Even though we have a timeout on the Send, it will succeed since for this | 905 // Even though we have a timeout on the Send, it will succeed since for this |
906 // bug, the reply message comes back and is deserialized, however the done | 906 // bug, the reply message comes back and is deserialized, however the done |
907 // event wasn't set. So we indirectly use the timeout task to notice if a | 907 // event wasn't set. So we indirectly use the timeout task to notice if a |
908 // timeout occurred. | 908 // timeout occurred. |
(...skipping 18 matching lines...) Expand all Loading... |
927 class TestSyncMessageFilter : public SyncMessageFilter { | 927 class TestSyncMessageFilter : public SyncMessageFilter { |
928 public: | 928 public: |
929 TestSyncMessageFilter(base::WaitableEvent* shutdown_event, | 929 TestSyncMessageFilter(base::WaitableEvent* shutdown_event, |
930 Worker* worker, | 930 Worker* worker, |
931 scoped_refptr<base::MessageLoopProxy> message_loop) | 931 scoped_refptr<base::MessageLoopProxy> message_loop) |
932 : SyncMessageFilter(shutdown_event), | 932 : SyncMessageFilter(shutdown_event), |
933 worker_(worker), | 933 worker_(worker), |
934 message_loop_(message_loop) { | 934 message_loop_(message_loop) { |
935 } | 935 } |
936 | 936 |
937 void OnFilterAdded(Sender* sender) override { | 937 virtual void OnFilterAdded(Sender* sender) override { |
938 SyncMessageFilter::OnFilterAdded(sender); | 938 SyncMessageFilter::OnFilterAdded(sender); |
939 message_loop_->PostTask( | 939 message_loop_->PostTask( |
940 FROM_HERE, | 940 FROM_HERE, |
941 base::Bind(&TestSyncMessageFilter::SendMessageOnHelperThread, this)); | 941 base::Bind(&TestSyncMessageFilter::SendMessageOnHelperThread, this)); |
942 } | 942 } |
943 | 943 |
944 void SendMessageOnHelperThread() { | 944 void SendMessageOnHelperThread() { |
945 int answer = 0; | 945 int answer = 0; |
946 bool result = Send(new SyncChannelTestMsg_AnswerToLife(&answer)); | 946 bool result = Send(new SyncChannelTestMsg_AnswerToLife(&answer)); |
947 DCHECK(result); | 947 DCHECK(result); |
948 DCHECK_EQ(answer, 42); | 948 DCHECK_EQ(answer, 42); |
949 | 949 |
950 worker_->Done(); | 950 worker_->Done(); |
951 } | 951 } |
952 | 952 |
953 private: | 953 private: |
954 ~TestSyncMessageFilter() override {} | 954 virtual ~TestSyncMessageFilter() {} |
955 | 955 |
956 Worker* worker_; | 956 Worker* worker_; |
957 scoped_refptr<base::MessageLoopProxy> message_loop_; | 957 scoped_refptr<base::MessageLoopProxy> message_loop_; |
958 }; | 958 }; |
959 | 959 |
960 class SyncMessageFilterServer : public Worker { | 960 class SyncMessageFilterServer : public Worker { |
961 public: | 961 public: |
962 SyncMessageFilterServer() | 962 SyncMessageFilterServer() |
963 : Worker(Channel::MODE_SERVER, "sync_message_filter_server"), | 963 : Worker(Channel::MODE_SERVER, "sync_message_filter_server"), |
964 thread_("helper_thread") { | 964 thread_("helper_thread") { |
965 base::Thread::Options options; | 965 base::Thread::Options options; |
966 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; | 966 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; |
967 thread_.StartWithOptions(options); | 967 thread_.StartWithOptions(options); |
968 filter_ = new TestSyncMessageFilter(shutdown_event(), this, | 968 filter_ = new TestSyncMessageFilter(shutdown_event(), this, |
969 thread_.message_loop_proxy()); | 969 thread_.message_loop_proxy()); |
970 } | 970 } |
971 | 971 |
972 void Run() override { channel()->AddFilter(filter_.get()); } | 972 virtual void Run() override { |
| 973 channel()->AddFilter(filter_.get()); |
| 974 } |
973 | 975 |
974 base::Thread thread_; | 976 base::Thread thread_; |
975 scoped_refptr<TestSyncMessageFilter> filter_; | 977 scoped_refptr<TestSyncMessageFilter> filter_; |
976 }; | 978 }; |
977 | 979 |
978 // This class provides functionality to test the case that a Send on the sync | 980 // This class provides functionality to test the case that a Send on the sync |
979 // channel does not crash after the channel has been closed. | 981 // channel does not crash after the channel has been closed. |
980 class ServerSendAfterClose : public Worker { | 982 class ServerSendAfterClose : public Worker { |
981 public: | 983 public: |
982 ServerSendAfterClose() | 984 ServerSendAfterClose() |
983 : Worker(Channel::MODE_SERVER, "simpler_server"), | 985 : Worker(Channel::MODE_SERVER, "simpler_server"), |
984 send_result_(true) { | 986 send_result_(true) { |
985 } | 987 } |
986 | 988 |
987 bool SendDummy() { | 989 bool SendDummy() { |
988 ListenerThread()->message_loop()->PostTask( | 990 ListenerThread()->message_loop()->PostTask( |
989 FROM_HERE, base::Bind(base::IgnoreResult(&ServerSendAfterClose::Send), | 991 FROM_HERE, base::Bind(base::IgnoreResult(&ServerSendAfterClose::Send), |
990 this, new SyncChannelTestMsg_NoArgs)); | 992 this, new SyncChannelTestMsg_NoArgs)); |
991 return true; | 993 return true; |
992 } | 994 } |
993 | 995 |
994 bool send_result() const { | 996 bool send_result() const { |
995 return send_result_; | 997 return send_result_; |
996 } | 998 } |
997 | 999 |
998 private: | 1000 private: |
999 void Run() override { | 1001 virtual void Run() override { |
1000 CloseChannel(); | 1002 CloseChannel(); |
1001 Done(); | 1003 Done(); |
1002 } | 1004 } |
1003 | 1005 |
1004 bool Send(Message* msg) override { | 1006 virtual bool Send(Message* msg) override { |
1005 send_result_ = Worker::Send(msg); | 1007 send_result_ = Worker::Send(msg); |
1006 Done(); | 1008 Done(); |
1007 return send_result_; | 1009 return send_result_; |
1008 } | 1010 } |
1009 | 1011 |
1010 bool send_result_; | 1012 bool send_result_; |
1011 }; | 1013 }; |
1012 | 1014 |
1013 // Tests basic synchronous call | 1015 // Tests basic synchronous call |
1014 TEST_F(IPCSyncChannelTest, SyncMessageFilter) { | 1016 TEST_F(IPCSyncChannelTest, SyncMessageFilter) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 } | 1058 } |
1057 | 1059 |
1058 void OnPingTTL(int ping, int* out) { | 1060 void OnPingTTL(int ping, int* out) { |
1059 *out = ping; | 1061 *out = ping; |
1060 wait_event_->Wait(); | 1062 wait_event_->Wait(); |
1061 } | 1063 } |
1062 | 1064 |
1063 base::Thread* ListenerThread() { return Worker::ListenerThread(); } | 1065 base::Thread* ListenerThread() { return Worker::ListenerThread(); } |
1064 | 1066 |
1065 private: | 1067 private: |
1066 bool OnMessageReceived(const Message& message) override { | 1068 virtual bool OnMessageReceived(const Message& message) override { |
1067 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchServer, message) | 1069 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchServer, message) |
1068 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) | 1070 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) |
1069 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_PingTTL, OnPingTTL) | 1071 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_PingTTL, OnPingTTL) |
1070 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Done, Done) | 1072 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Done, Done) |
1071 IPC_END_MESSAGE_MAP() | 1073 IPC_END_MESSAGE_MAP() |
1072 return true; | 1074 return true; |
1073 } | 1075 } |
1074 | 1076 |
1075 void OnPingSent() { | 1077 void OnPingSent() { |
1076 sent_ping_event_->Signal(); | 1078 sent_ping_event_->Signal(); |
(...skipping 12 matching lines...) Expand all Loading... |
1089 | 1091 |
1090 base::Thread* ListenerThread() { return Worker::ListenerThread(); } | 1092 base::Thread* ListenerThread() { return Worker::ListenerThread(); } |
1091 | 1093 |
1092 void OnDoPingTTL(int ping) { | 1094 void OnDoPingTTL(int ping) { |
1093 int value = 0; | 1095 int value = 0; |
1094 Send(new SyncChannelTestMsg_PingTTL(ping, &value)); | 1096 Send(new SyncChannelTestMsg_PingTTL(ping, &value)); |
1095 signal_event_->Signal(); | 1097 signal_event_->Signal(); |
1096 } | 1098 } |
1097 | 1099 |
1098 private: | 1100 private: |
1099 bool OnMessageReceived(const Message& message) override { | 1101 virtual bool OnMessageReceived(const Message& message) override { |
1100 IPC_BEGIN_MESSAGE_MAP(NonRestrictedDispatchServer, message) | 1102 IPC_BEGIN_MESSAGE_MAP(NonRestrictedDispatchServer, message) |
1101 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) | 1103 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) |
1102 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Done, Done) | 1104 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Done, Done) |
1103 IPC_END_MESSAGE_MAP() | 1105 IPC_END_MESSAGE_MAP() |
1104 return true; | 1106 return true; |
1105 } | 1107 } |
1106 | 1108 |
1107 void OnNoArgs() { } | 1109 void OnNoArgs() { } |
1108 WaitableEvent* signal_event_; | 1110 WaitableEvent* signal_event_; |
1109 }; | 1111 }; |
1110 | 1112 |
1111 class RestrictedDispatchClient : public Worker { | 1113 class RestrictedDispatchClient : public Worker { |
1112 public: | 1114 public: |
1113 RestrictedDispatchClient(WaitableEvent* sent_ping_event, | 1115 RestrictedDispatchClient(WaitableEvent* sent_ping_event, |
1114 RestrictedDispatchServer* server, | 1116 RestrictedDispatchServer* server, |
1115 NonRestrictedDispatchServer* server2, | 1117 NonRestrictedDispatchServer* server2, |
1116 int* success) | 1118 int* success) |
1117 : Worker("restricted_channel", Channel::MODE_CLIENT), | 1119 : Worker("restricted_channel", Channel::MODE_CLIENT), |
1118 ping_(0), | 1120 ping_(0), |
1119 server_(server), | 1121 server_(server), |
1120 server2_(server2), | 1122 server2_(server2), |
1121 success_(success), | 1123 success_(success), |
1122 sent_ping_event_(sent_ping_event) {} | 1124 sent_ping_event_(sent_ping_event) {} |
1123 | 1125 |
1124 void Run() override { | 1126 virtual void Run() override { |
1125 // Incoming messages from our channel should only be dispatched when we | 1127 // Incoming messages from our channel should only be dispatched when we |
1126 // send a message on that same channel. | 1128 // send a message on that same channel. |
1127 channel()->SetRestrictDispatchChannelGroup(1); | 1129 channel()->SetRestrictDispatchChannelGroup(1); |
1128 | 1130 |
1129 server_->ListenerThread()->message_loop()->PostTask( | 1131 server_->ListenerThread()->message_loop()->PostTask( |
1130 FROM_HERE, base::Bind(&RestrictedDispatchServer::OnDoPing, server_, 1)); | 1132 FROM_HERE, base::Bind(&RestrictedDispatchServer::OnDoPing, server_, 1)); |
1131 sent_ping_event_->Wait(); | 1133 sent_ping_event_->Wait(); |
1132 Send(new SyncChannelTestMsg_NoArgs); | 1134 Send(new SyncChannelTestMsg_NoArgs); |
1133 if (ping_ == 1) | 1135 if (ping_ == 1) |
1134 ++*success_; | 1136 ++*success_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 else | 1180 else |
1179 LOG(ERROR) << "Send failed to dispatch message from unrestricted channel"; | 1181 LOG(ERROR) << "Send failed to dispatch message from unrestricted channel"; |
1180 | 1182 |
1181 non_restricted_channel_->Send(new SyncChannelTestMsg_Done); | 1183 non_restricted_channel_->Send(new SyncChannelTestMsg_Done); |
1182 non_restricted_channel_.reset(); | 1184 non_restricted_channel_.reset(); |
1183 Send(new SyncChannelTestMsg_Done); | 1185 Send(new SyncChannelTestMsg_Done); |
1184 Done(); | 1186 Done(); |
1185 } | 1187 } |
1186 | 1188 |
1187 private: | 1189 private: |
1188 bool OnMessageReceived(const Message& message) override { | 1190 virtual bool OnMessageReceived(const Message& message) override { |
1189 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchClient, message) | 1191 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchClient, message) |
1190 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Ping, OnPing) | 1192 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Ping, OnPing) |
1191 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_PingTTL, OnPingTTL) | 1193 IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_PingTTL, OnPingTTL) |
1192 IPC_END_MESSAGE_MAP() | 1194 IPC_END_MESSAGE_MAP() |
1193 return true; | 1195 return true; |
1194 } | 1196 } |
1195 | 1197 |
1196 void OnPing(int ping) { | 1198 void OnPing(int ping) { |
1197 ping_ = ping; | 1199 ping_ = ping; |
1198 } | 1200 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 events_(events), | 1274 events_(events), |
1273 peer_(peer) { } | 1275 peer_(peer) { } |
1274 | 1276 |
1275 void OnDoServerTask() { | 1277 void OnDoServerTask() { |
1276 events_[3]->Signal(); | 1278 events_[3]->Signal(); |
1277 events_[2]->Wait(); | 1279 events_[2]->Wait(); |
1278 events_[0]->Signal(); | 1280 events_[0]->Signal(); |
1279 SendMessageToClient(); | 1281 SendMessageToClient(); |
1280 } | 1282 } |
1281 | 1283 |
1282 void Run() override { | 1284 virtual void Run() override { |
1283 channel()->SetRestrictDispatchChannelGroup(1); | 1285 channel()->SetRestrictDispatchChannelGroup(1); |
1284 server_ready_event_->Signal(); | 1286 server_ready_event_->Signal(); |
1285 } | 1287 } |
1286 | 1288 |
1287 base::Thread* ListenerThread() { return Worker::ListenerThread(); } | 1289 base::Thread* ListenerThread() { return Worker::ListenerThread(); } |
1288 | 1290 |
1289 private: | 1291 private: |
1290 bool OnMessageReceived(const Message& message) override { | 1292 virtual bool OnMessageReceived(const Message& message) override { |
1291 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchDeadlockServer, message) | 1293 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchDeadlockServer, message) |
1292 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) | 1294 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) |
1293 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Done, Done) | 1295 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Done, Done) |
1294 IPC_END_MESSAGE_MAP() | 1296 IPC_END_MESSAGE_MAP() |
1295 return true; | 1297 return true; |
1296 } | 1298 } |
1297 | 1299 |
1298 void OnNoArgs() { | 1300 void OnNoArgs() { |
1299 if (server_num_ == 1) { | 1301 if (server_num_ == 1) { |
1300 DCHECK(peer_ != NULL); | 1302 DCHECK(peer_ != NULL); |
(...skipping 19 matching lines...) Expand all Loading... |
1320 RestrictedDispatchDeadlockClient2(RestrictedDispatchDeadlockServer* server, | 1322 RestrictedDispatchDeadlockClient2(RestrictedDispatchDeadlockServer* server, |
1321 WaitableEvent* server_ready_event, | 1323 WaitableEvent* server_ready_event, |
1322 WaitableEvent** events) | 1324 WaitableEvent** events) |
1323 : Worker("channel2", Channel::MODE_CLIENT), | 1325 : Worker("channel2", Channel::MODE_CLIENT), |
1324 server_ready_event_(server_ready_event), | 1326 server_ready_event_(server_ready_event), |
1325 events_(events), | 1327 events_(events), |
1326 received_msg_(false), | 1328 received_msg_(false), |
1327 received_noarg_reply_(false), | 1329 received_noarg_reply_(false), |
1328 done_issued_(false) {} | 1330 done_issued_(false) {} |
1329 | 1331 |
1330 void Run() override { server_ready_event_->Wait(); } | 1332 virtual void Run() override { |
| 1333 server_ready_event_->Wait(); |
| 1334 } |
1331 | 1335 |
1332 void OnDoClient2Task() { | 1336 void OnDoClient2Task() { |
1333 events_[3]->Wait(); | 1337 events_[3]->Wait(); |
1334 events_[1]->Signal(); | 1338 events_[1]->Signal(); |
1335 events_[2]->Signal(); | 1339 events_[2]->Signal(); |
1336 DCHECK(received_msg_ == false); | 1340 DCHECK(received_msg_ == false); |
1337 | 1341 |
1338 Message* message = new SyncChannelTestMsg_NoArgs; | 1342 Message* message = new SyncChannelTestMsg_NoArgs; |
1339 message->set_unblock(true); | 1343 message->set_unblock(true); |
1340 Send(message); | 1344 Send(message); |
1341 received_noarg_reply_ = true; | 1345 received_noarg_reply_ = true; |
1342 } | 1346 } |
1343 | 1347 |
1344 base::Thread* ListenerThread() { return Worker::ListenerThread(); } | 1348 base::Thread* ListenerThread() { return Worker::ListenerThread(); } |
1345 private: | 1349 private: |
1346 bool OnMessageReceived(const Message& message) override { | 1350 virtual bool OnMessageReceived(const Message& message) override { |
1347 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchDeadlockClient2, message) | 1351 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchDeadlockClient2, message) |
1348 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) | 1352 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) |
1349 IPC_END_MESSAGE_MAP() | 1353 IPC_END_MESSAGE_MAP() |
1350 return true; | 1354 return true; |
1351 } | 1355 } |
1352 | 1356 |
1353 void OnNoArgs() { | 1357 void OnNoArgs() { |
1354 received_msg_ = true; | 1358 received_msg_ = true; |
1355 PossiblyDone(); | 1359 PossiblyDone(); |
1356 } | 1360 } |
(...skipping 22 matching lines...) Expand all Loading... |
1379 WaitableEvent** events) | 1383 WaitableEvent** events) |
1380 : Worker("channel1", Channel::MODE_CLIENT), | 1384 : Worker("channel1", Channel::MODE_CLIENT), |
1381 server_(server), | 1385 server_(server), |
1382 peer_(peer), | 1386 peer_(peer), |
1383 server_ready_event_(server_ready_event), | 1387 server_ready_event_(server_ready_event), |
1384 events_(events), | 1388 events_(events), |
1385 received_msg_(false), | 1389 received_msg_(false), |
1386 received_noarg_reply_(false), | 1390 received_noarg_reply_(false), |
1387 done_issued_(false) {} | 1391 done_issued_(false) {} |
1388 | 1392 |
1389 void Run() override { | 1393 virtual void Run() override { |
1390 server_ready_event_->Wait(); | 1394 server_ready_event_->Wait(); |
1391 server_->ListenerThread()->message_loop()->PostTask( | 1395 server_->ListenerThread()->message_loop()->PostTask( |
1392 FROM_HERE, | 1396 FROM_HERE, |
1393 base::Bind(&RestrictedDispatchDeadlockServer::OnDoServerTask, server_)); | 1397 base::Bind(&RestrictedDispatchDeadlockServer::OnDoServerTask, server_)); |
1394 peer_->ListenerThread()->message_loop()->PostTask( | 1398 peer_->ListenerThread()->message_loop()->PostTask( |
1395 FROM_HERE, | 1399 FROM_HERE, |
1396 base::Bind(&RestrictedDispatchDeadlockClient2::OnDoClient2Task, peer_)); | 1400 base::Bind(&RestrictedDispatchDeadlockClient2::OnDoClient2Task, peer_)); |
1397 events_[0]->Wait(); | 1401 events_[0]->Wait(); |
1398 events_[1]->Wait(); | 1402 events_[1]->Wait(); |
1399 DCHECK(received_msg_ == false); | 1403 DCHECK(received_msg_ == false); |
1400 | 1404 |
1401 Message* message = new SyncChannelTestMsg_NoArgs; | 1405 Message* message = new SyncChannelTestMsg_NoArgs; |
1402 message->set_unblock(true); | 1406 message->set_unblock(true); |
1403 Send(message); | 1407 Send(message); |
1404 received_noarg_reply_ = true; | 1408 received_noarg_reply_ = true; |
1405 PossiblyDone(); | 1409 PossiblyDone(); |
1406 } | 1410 } |
1407 | 1411 |
1408 private: | 1412 private: |
1409 bool OnMessageReceived(const Message& message) override { | 1413 virtual bool OnMessageReceived(const Message& message) override { |
1410 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchDeadlockClient1, message) | 1414 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchDeadlockClient1, message) |
1411 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) | 1415 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) |
1412 IPC_END_MESSAGE_MAP() | 1416 IPC_END_MESSAGE_MAP() |
1413 return true; | 1417 return true; |
1414 } | 1418 } |
1415 | 1419 |
1416 void OnNoArgs() { | 1420 void OnNoArgs() { |
1417 received_msg_ = true; | 1421 received_msg_ = true; |
1418 PossiblyDone(); | 1422 PossiblyDone(); |
1419 } | 1423 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 } | 1516 } |
1513 | 1517 |
1514 void OnDone() { | 1518 void OnDone() { |
1515 if (is_first()) | 1519 if (is_first()) |
1516 return; | 1520 return; |
1517 other_channel_->Send(new SyncChannelTestMsg_Done); | 1521 other_channel_->Send(new SyncChannelTestMsg_Done); |
1518 other_channel_.reset(); | 1522 other_channel_.reset(); |
1519 Done(); | 1523 Done(); |
1520 } | 1524 } |
1521 | 1525 |
1522 void Run() override { | 1526 virtual void Run() override { |
1523 channel()->SetRestrictDispatchChannelGroup(group_); | 1527 channel()->SetRestrictDispatchChannelGroup(group_); |
1524 if (is_first()) | 1528 if (is_first()) |
1525 event1_->Signal(); | 1529 event1_->Signal(); |
1526 event2_->Wait(); | 1530 event2_->Wait(); |
1527 other_channel_ = | 1531 other_channel_ = |
1528 SyncChannel::Create(other_channel_name_, | 1532 SyncChannel::Create(other_channel_name_, |
1529 IPC::Channel::MODE_CLIENT, | 1533 IPC::Channel::MODE_CLIENT, |
1530 this, | 1534 this, |
1531 ipc_thread().message_loop_proxy().get(), | 1535 ipc_thread().message_loop_proxy().get(), |
1532 true, | 1536 true, |
(...skipping 12 matching lines...) Expand all Loading... |
1545 OnPingTTL(5, &value); | 1549 OnPingTTL(5, &value); |
1546 *success_ += (value == 5); | 1550 *success_ += (value == 5); |
1547 other_channel_->Send(new SyncChannelTestMsg_Done); | 1551 other_channel_->Send(new SyncChannelTestMsg_Done); |
1548 other_channel_.reset(); | 1552 other_channel_.reset(); |
1549 Done(); | 1553 Done(); |
1550 } | 1554 } |
1551 | 1555 |
1552 bool is_first() { return !!success_; } | 1556 bool is_first() { return !!success_; } |
1553 | 1557 |
1554 private: | 1558 private: |
1555 bool OnMessageReceived(const Message& message) override { | 1559 virtual bool OnMessageReceived(const Message& message) override { |
1556 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchPipeWorker, message) | 1560 IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchPipeWorker, message) |
1557 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_PingTTL, OnPingTTL) | 1561 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_PingTTL, OnPingTTL) |
1558 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Done, OnDone) | 1562 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Done, OnDone) |
1559 IPC_END_MESSAGE_MAP() | 1563 IPC_END_MESSAGE_MAP() |
1560 return true; | 1564 return true; |
1561 } | 1565 } |
1562 | 1566 |
1563 scoped_ptr<SyncChannel> other_channel_; | 1567 scoped_ptr<SyncChannel> other_channel_; |
1564 WaitableEvent* event1_; | 1568 WaitableEvent* event1_; |
1565 WaitableEvent* event2_; | 1569 WaitableEvent* event2_; |
(...skipping 30 matching lines...) Expand all Loading... |
1596 // during which it will dispatch a message comming from Client, at which point | 1600 // during which it will dispatch a message comming from Client, at which point |
1597 // it will send another message to Server2. While sending that second message it | 1601 // it will send another message to Server2. While sending that second message it |
1598 // will receive a reply from Server1 with the unblock flag. | 1602 // will receive a reply from Server1 with the unblock flag. |
1599 | 1603 |
1600 class ReentrantReplyServer1 : public Worker { | 1604 class ReentrantReplyServer1 : public Worker { |
1601 public: | 1605 public: |
1602 ReentrantReplyServer1(WaitableEvent* server_ready) | 1606 ReentrantReplyServer1(WaitableEvent* server_ready) |
1603 : Worker("reentrant_reply1", Channel::MODE_SERVER), | 1607 : Worker("reentrant_reply1", Channel::MODE_SERVER), |
1604 server_ready_(server_ready) { } | 1608 server_ready_(server_ready) { } |
1605 | 1609 |
1606 void Run() override { | 1610 virtual void Run() override { |
1607 server2_channel_ = | 1611 server2_channel_ = |
1608 SyncChannel::Create("reentrant_reply2", | 1612 SyncChannel::Create("reentrant_reply2", |
1609 IPC::Channel::MODE_CLIENT, | 1613 IPC::Channel::MODE_CLIENT, |
1610 this, | 1614 this, |
1611 ipc_thread().message_loop_proxy().get(), | 1615 ipc_thread().message_loop_proxy().get(), |
1612 true, | 1616 true, |
1613 shutdown_event()); | 1617 shutdown_event()); |
1614 server_ready_->Signal(); | 1618 server_ready_->Signal(); |
1615 Message* msg = new SyncChannelTestMsg_Reentrant1(); | 1619 Message* msg = new SyncChannelTestMsg_Reentrant1(); |
1616 server2_channel_->Send(msg); | 1620 server2_channel_->Send(msg); |
1617 server2_channel_.reset(); | 1621 server2_channel_.reset(); |
1618 Done(); | 1622 Done(); |
1619 } | 1623 } |
1620 | 1624 |
1621 private: | 1625 private: |
1622 bool OnMessageReceived(const Message& message) override { | 1626 virtual bool OnMessageReceived(const Message& message) override { |
1623 IPC_BEGIN_MESSAGE_MAP(ReentrantReplyServer1, message) | 1627 IPC_BEGIN_MESSAGE_MAP(ReentrantReplyServer1, message) |
1624 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Reentrant2, OnReentrant2) | 1628 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Reentrant2, OnReentrant2) |
1625 IPC_REPLY_HANDLER(OnReply) | 1629 IPC_REPLY_HANDLER(OnReply) |
1626 IPC_END_MESSAGE_MAP() | 1630 IPC_END_MESSAGE_MAP() |
1627 return true; | 1631 return true; |
1628 } | 1632 } |
1629 | 1633 |
1630 void OnReentrant2() { | 1634 void OnReentrant2() { |
1631 Message* msg = new SyncChannelTestMsg_Reentrant3(); | 1635 Message* msg = new SyncChannelTestMsg_Reentrant3(); |
1632 server2_channel_->Send(msg); | 1636 server2_channel_->Send(msg); |
1633 } | 1637 } |
1634 | 1638 |
1635 void OnReply(const Message& message) { | 1639 void OnReply(const Message& message) { |
1636 // If we get here, the Send() will never receive the reply (thus would | 1640 // If we get here, the Send() will never receive the reply (thus would |
1637 // hang), so abort instead. | 1641 // hang), so abort instead. |
1638 LOG(FATAL) << "Reply message was dispatched"; | 1642 LOG(FATAL) << "Reply message was dispatched"; |
1639 } | 1643 } |
1640 | 1644 |
1641 WaitableEvent* server_ready_; | 1645 WaitableEvent* server_ready_; |
1642 scoped_ptr<SyncChannel> server2_channel_; | 1646 scoped_ptr<SyncChannel> server2_channel_; |
1643 }; | 1647 }; |
1644 | 1648 |
1645 class ReentrantReplyServer2 : public Worker { | 1649 class ReentrantReplyServer2 : public Worker { |
1646 public: | 1650 public: |
1647 ReentrantReplyServer2() | 1651 ReentrantReplyServer2() |
1648 : Worker("reentrant_reply2", Channel::MODE_SERVER), | 1652 : Worker("reentrant_reply2", Channel::MODE_SERVER), |
1649 reply_(NULL) { } | 1653 reply_(NULL) { } |
1650 | 1654 |
1651 private: | 1655 private: |
1652 bool OnMessageReceived(const Message& message) override { | 1656 virtual bool OnMessageReceived(const Message& message) override { |
1653 IPC_BEGIN_MESSAGE_MAP(ReentrantReplyServer2, message) | 1657 IPC_BEGIN_MESSAGE_MAP(ReentrantReplyServer2, message) |
1654 IPC_MESSAGE_HANDLER_DELAY_REPLY( | 1658 IPC_MESSAGE_HANDLER_DELAY_REPLY( |
1655 SyncChannelTestMsg_Reentrant1, OnReentrant1) | 1659 SyncChannelTestMsg_Reentrant1, OnReentrant1) |
1656 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Reentrant3, OnReentrant3) | 1660 IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Reentrant3, OnReentrant3) |
1657 IPC_END_MESSAGE_MAP() | 1661 IPC_END_MESSAGE_MAP() |
1658 return true; | 1662 return true; |
1659 } | 1663 } |
1660 | 1664 |
1661 void OnReentrant1(Message* reply) { | 1665 void OnReentrant1(Message* reply) { |
1662 DCHECK(!reply_); | 1666 DCHECK(!reply_); |
(...skipping 11 matching lines...) Expand all Loading... |
1674 | 1678 |
1675 Message* reply_; | 1679 Message* reply_; |
1676 }; | 1680 }; |
1677 | 1681 |
1678 class ReentrantReplyClient : public Worker { | 1682 class ReentrantReplyClient : public Worker { |
1679 public: | 1683 public: |
1680 ReentrantReplyClient(WaitableEvent* server_ready) | 1684 ReentrantReplyClient(WaitableEvent* server_ready) |
1681 : Worker("reentrant_reply1", Channel::MODE_CLIENT), | 1685 : Worker("reentrant_reply1", Channel::MODE_CLIENT), |
1682 server_ready_(server_ready) { } | 1686 server_ready_(server_ready) { } |
1683 | 1687 |
1684 void Run() override { | 1688 virtual void Run() override { |
1685 server_ready_->Wait(); | 1689 server_ready_->Wait(); |
1686 Send(new SyncChannelTestMsg_Reentrant2()); | 1690 Send(new SyncChannelTestMsg_Reentrant2()); |
1687 Done(); | 1691 Done(); |
1688 } | 1692 } |
1689 | 1693 |
1690 private: | 1694 private: |
1691 WaitableEvent* server_ready_; | 1695 WaitableEvent* server_ready_; |
1692 }; | 1696 }; |
1693 | 1697 |
1694 TEST_F(IPCSyncChannelTest, ReentrantReply) { | 1698 TEST_F(IPCSyncChannelTest, ReentrantReply) { |
(...skipping 12 matching lines...) Expand all Loading... |
1707 class VerifiedServer : public Worker { | 1711 class VerifiedServer : public Worker { |
1708 public: | 1712 public: |
1709 VerifiedServer(base::Thread* listener_thread, | 1713 VerifiedServer(base::Thread* listener_thread, |
1710 const std::string& channel_name, | 1714 const std::string& channel_name, |
1711 const std::string& reply_text) | 1715 const std::string& reply_text) |
1712 : Worker(channel_name, Channel::MODE_SERVER), | 1716 : Worker(channel_name, Channel::MODE_SERVER), |
1713 reply_text_(reply_text) { | 1717 reply_text_(reply_text) { |
1714 Worker::OverrideThread(listener_thread); | 1718 Worker::OverrideThread(listener_thread); |
1715 } | 1719 } |
1716 | 1720 |
1717 void OnNestedTestMsg(Message* reply_msg) override { | 1721 virtual void OnNestedTestMsg(Message* reply_msg) override { |
1718 VLOG(1) << __FUNCTION__ << " Sending reply: " << reply_text_; | 1722 VLOG(1) << __FUNCTION__ << " Sending reply: " << reply_text_; |
1719 SyncChannelNestedTestMsg_String::WriteReplyParams(reply_msg, reply_text_); | 1723 SyncChannelNestedTestMsg_String::WriteReplyParams(reply_msg, reply_text_); |
1720 Send(reply_msg); | 1724 Send(reply_msg); |
1721 ASSERT_EQ(channel()->GetPeerPID(), base::GetCurrentProcId()); | 1725 ASSERT_EQ(channel()->GetPeerPID(), base::GetCurrentProcId()); |
1722 Done(); | 1726 Done(); |
1723 } | 1727 } |
1724 | 1728 |
1725 private: | 1729 private: |
1726 std::string reply_text_; | 1730 std::string reply_text_; |
1727 }; | 1731 }; |
1728 | 1732 |
1729 class VerifiedClient : public Worker { | 1733 class VerifiedClient : public Worker { |
1730 public: | 1734 public: |
1731 VerifiedClient(base::Thread* listener_thread, | 1735 VerifiedClient(base::Thread* listener_thread, |
1732 const std::string& channel_name, | 1736 const std::string& channel_name, |
1733 const std::string& expected_text) | 1737 const std::string& expected_text) |
1734 : Worker(channel_name, Channel::MODE_CLIENT), | 1738 : Worker(channel_name, Channel::MODE_CLIENT), |
1735 expected_text_(expected_text) { | 1739 expected_text_(expected_text) { |
1736 Worker::OverrideThread(listener_thread); | 1740 Worker::OverrideThread(listener_thread); |
1737 } | 1741 } |
1738 | 1742 |
1739 void Run() override { | 1743 virtual void Run() override { |
1740 std::string response; | 1744 std::string response; |
1741 SyncMessage* msg = new SyncChannelNestedTestMsg_String(&response); | 1745 SyncMessage* msg = new SyncChannelNestedTestMsg_String(&response); |
1742 bool result = Send(msg); | 1746 bool result = Send(msg); |
1743 DCHECK(result); | 1747 DCHECK(result); |
1744 DCHECK_EQ(response, expected_text_); | 1748 DCHECK_EQ(response, expected_text_); |
1745 // expected_text_ is only used in the above DCHECK. This line suppresses the | 1749 // expected_text_ is only used in the above DCHECK. This line suppresses the |
1746 // "unused private field" warning in release builds. | 1750 // "unused private field" warning in release builds. |
1747 (void)expected_text_; | 1751 (void)expected_text_; |
1748 | 1752 |
1749 VLOG(1) << __FUNCTION__ << " Received reply: " << response; | 1753 VLOG(1) << __FUNCTION__ << " Received reply: " << response; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 } | 1786 } |
1783 | 1787 |
1784 // Windows needs to send an out-of-band secret to verify the client end of the | 1788 // Windows needs to send an out-of-band secret to verify the client end of the |
1785 // channel. Test that we still connect correctly in that case. | 1789 // channel. Test that we still connect correctly in that case. |
1786 TEST_F(IPCSyncChannelTest, Verified) { | 1790 TEST_F(IPCSyncChannelTest, Verified) { |
1787 Verified(); | 1791 Verified(); |
1788 } | 1792 } |
1789 | 1793 |
1790 } // namespace | 1794 } // namespace |
1791 } // namespace IPC | 1795 } // namespace IPC |
OLD | NEW |