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

Side by Side Diff: ipc/ipc_channel_win.cc

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

Powered by Google App Engine
This is Rietveld 408576698