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

Side by Side Diff: ipc/ipc_channel_win.cc

Issue 1321803003: ipc: Make sure that ChannelReader is destroyed correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_add_header4
Patch Set: Rebase against top of tree. Created 5 years, 3 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_reader.cc ('k') | 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 <stdint.h> 7 #include <stdint.h>
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 waiting_connect_(mode & MODE_SERVER_FLAG), 47 waiting_connect_(mode & MODE_SERVER_FLAG),
48 processing_incoming_(false), 48 processing_incoming_(false),
49 validate_client_(false), 49 validate_client_(false),
50 client_secret_(0), 50 client_secret_(0),
51 broker_(broker), 51 broker_(broker),
52 weak_factory_(this) { 52 weak_factory_(this) {
53 CreatePipe(channel_handle, mode); 53 CreatePipe(channel_handle, mode);
54 } 54 }
55 55
56 ChannelWin::~ChannelWin() { 56 ChannelWin::~ChannelWin() {
57 CleanUp();
57 Close(); 58 Close();
58 } 59 }
59 60
60 void ChannelWin::Close() { 61 void ChannelWin::Close() {
61 if (thread_check_.get()) 62 if (thread_check_.get())
62 DCHECK(thread_check_->CalledOnValidThread()); 63 DCHECK(thread_check_->CalledOnValidThread());
63 64
64 if (input_state_.is_pending || output_state_.is_pending) 65 if (input_state_.is_pending || output_state_.is_pending)
65 CancelIo(pipe_.Get()); 66 CancelIo(pipe_.Get());
66 67
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 int secret; 577 int secret;
577 do { // Guarantee we get a non-zero value. 578 do { // Guarantee we get a non-zero value.
578 secret = base::RandInt(0, std::numeric_limits<int>::max()); 579 secret = base::RandInt(0, std::numeric_limits<int>::max());
579 } while (secret == 0); 580 } while (secret == 0);
580 581
581 id.append(GenerateUniqueRandomChannelID()); 582 id.append(GenerateUniqueRandomChannelID());
582 return id.append(base::StringPrintf("\\%d", secret)); 583 return id.append(base::StringPrintf("\\%d", secret));
583 } 584 }
584 585
585 } // namespace IPC 586 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_reader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698