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

Side by Side Diff: ipc/ipc_channel_win.cc

Issue 2211473003: Remove calls to deprecated MessageLoop methods on Windows and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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
« no previous file with comments | « ipc/ipc_channel_unittest.cc ('k') | jingle/notifier/listener/xmpp_push_client_unittest.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 (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_channel_win.h" 5 #include "ipc/ipc_channel_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include "base/auto_reset.h" 11 #include "base/auto_reset.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/pickle.h" 16 #include "base/pickle.h"
17 #include "base/process/process_handle.h" 17 #include "base/process/process_handle.h"
18 #include "base/rand_util.h" 18 #include "base/rand_util.h"
19 #include "base/single_thread_task_runner.h"
19 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
21 #include "base/threading/thread_checker.h" 22 #include "base/threading/thread_checker.h"
22 #include "base/win/scoped_handle.h" 23 #include "base/win/scoped_handle.h"
23 #include "ipc/attachment_broker.h" 24 #include "ipc/attachment_broker.h"
24 #include "ipc/ipc_listener.h" 25 #include "ipc/ipc_listener.h"
25 #include "ipc/ipc_logging.h" 26 #include "ipc/ipc_logging.h"
26 #include "ipc/ipc_message_attachment_set.h" 27 #include "ipc/ipc_message_attachment_set.h"
27 #include "ipc/ipc_message_utils.h" 28 #include "ipc/ipc_message_utils.h"
28 29
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 base::MessageLoopForIO::current()->RegisterIOHandler(pipe_.Get(), this); 406 base::MessageLoopForIO::current()->RegisterIOHandler(pipe_.Get(), this);
406 407
407 // Check to see if there is a client connected to our pipe... 408 // Check to see if there is a client connected to our pipe...
408 if (waiting_connect_) 409 if (waiting_connect_)
409 ProcessConnection(); 410 ProcessConnection();
410 411
411 if (!input_state_.is_pending) { 412 if (!input_state_.is_pending) {
412 // Complete setup asynchronously. By not setting input_state_.is_pending 413 // Complete setup asynchronously. By not setting input_state_.is_pending
413 // to true, we indicate to OnIOCompleted that this is the special 414 // to true, we indicate to OnIOCompleted that this is the special
414 // initialization signal. 415 // initialization signal.
415 base::MessageLoopForIO::current()->PostTask( 416 base::MessageLoopForIO::current()->task_runner()->PostTask(
416 FROM_HERE, 417 FROM_HERE,
417 base::Bind(&ChannelWin::OnIOCompleted, 418 base::Bind(&ChannelWin::OnIOCompleted, weak_factory_.GetWeakPtr(),
418 weak_factory_.GetWeakPtr(), 419 &input_state_.context, 0, 0));
419 &input_state_.context,
420 0,
421 0));
422 } 420 }
423 421
424 if (!waiting_connect_) 422 if (!waiting_connect_)
425 ProcessOutgoingMessages(NULL, 0); 423 ProcessOutgoingMessages(NULL, 0);
426 return true; 424 return true;
427 } 425 }
428 426
429 bool ChannelWin::ProcessConnection() { 427 bool ChannelWin::ProcessConnection() {
430 DCHECK(thread_check_->CalledOnValidThread()); 428 DCHECK(thread_check_->CalledOnValidThread());
431 if (input_state_.is_pending) 429 if (input_state_.is_pending)
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 int secret; 604 int secret;
607 do { // Guarantee we get a non-zero value. 605 do { // Guarantee we get a non-zero value.
608 secret = base::RandInt(0, std::numeric_limits<int>::max()); 606 secret = base::RandInt(0, std::numeric_limits<int>::max());
609 } while (secret == 0); 607 } while (secret == 0);
610 608
611 id.append(GenerateUniqueRandomChannelID()); 609 id.append(GenerateUniqueRandomChannelID());
612 return id.append(base::StringPrintf("\\%d", secret)); 610 return id.append(base::StringPrintf("\\%d", secret));
613 } 611 }
614 612
615 } // namespace IPC 613 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_unittest.cc ('k') | jingle/notifier/listener/xmpp_push_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698