Commit fdd8921b authored by yzshen@chromium.org's avatar yzshen@chromium.org

Revert 286239 "Reland r285211: "Debugging RawChannelWin: replace..."

> Reland r285211: "Debugging RawChannelWin: replace DCHECK with CHECK and record write stats."
> 
> But clang-formatted (and after the changed files were clang-formatted).
> This should be reverted on the same schedule as the original change (no
> later than August 1, 2014).
> 
> > Debugging RawChannelWin: replace DCHECK with CHECK and record write stats.
> >
> > This is a temp change for debugging purpose. It should be reverted once
> > we fix the issue or find out the change doesn't reveal anything. (No later than Aug 1, 2014.)
> >
> > BUG=385795
> > TEST=None
> 
> BUG=385795
> TBR=yzshen@chromium.org
> 
> Review URL: https://codereview.chromium.org/430473004

TBR=viettrungluu@chromium.org

Review URL: https://codereview.chromium.org/449063003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288092 0039d316-1c4b-4281-b951-d872f2087c98
parent f3b1c76f
......@@ -30,7 +30,7 @@ RawChannel::ReadBuffer::~ReadBuffer() {
}
void RawChannel::ReadBuffer::GetBuffer(char** addr, size_t* size) {
CHECK_GE(buffer_.size(), num_valid_bytes_ + kReadSize);
DCHECK_GE(buffer_.size(), num_valid_bytes_ + kReadSize);
*addr = &buffer_[0] + num_valid_bytes_;
*size = kReadSize;
}
......@@ -59,11 +59,11 @@ bool RawChannel::WriteBuffer::HavePlatformHandlesToSend() const {
const embedder::PlatformHandleVector* all_platform_handles =
transport_data->platform_handles();
if (!all_platform_handles) {
CHECK_EQ(platform_handles_offset_, 0u);
DCHECK_EQ(platform_handles_offset_, 0u);
return false;
}
if (platform_handles_offset_ >= all_platform_handles->size()) {
CHECK_EQ(platform_handles_offset_, all_platform_handles->size());
DCHECK_EQ(platform_handles_offset_, all_platform_handles->size());
return false;
}
......@@ -74,7 +74,7 @@ void RawChannel::WriteBuffer::GetPlatformHandlesToSend(
size_t* num_platform_handles,
embedder::PlatformHandle** platform_handles,
void** serialization_data) {
CHECK(HavePlatformHandlesToSend());
DCHECK(HavePlatformHandlesToSend());
TransportData* transport_data = message_queue_.front()->transport_data();
embedder::PlatformHandleVector* all_platform_handles =
......@@ -84,7 +84,7 @@ void RawChannel::WriteBuffer::GetPlatformHandlesToSend(
*platform_handles = &(*all_platform_handles)[platform_handles_offset_];
size_t serialization_data_offset =
transport_data->platform_handle_table_offset();
CHECK_GT(serialization_data_offset, 0u);
DCHECK_GT(serialization_data_offset, 0u);
serialization_data_offset +=
platform_handles_offset_ * serialized_platform_handle_size_;
*serialization_data =
......@@ -98,7 +98,7 @@ void RawChannel::WriteBuffer::GetBuffers(std::vector<Buffer>* buffers) const {
return;
MessageInTransit* message = message_queue_.front();
CHECK_LT(data_offset_, message->total_size());
DCHECK_LT(data_offset_, message->total_size());
size_t bytes_to_write = message->total_size() - data_offset_;
size_t transport_data_buffer_size =
......@@ -106,8 +106,8 @@ void RawChannel::WriteBuffer::GetBuffers(std::vector<Buffer>* buffers) const {
if (!transport_data_buffer_size) {
// Only write from the main buffer.
CHECK_LT(data_offset_, message->main_buffer_size());
CHECK_LE(bytes_to_write, message->main_buffer_size());
DCHECK_LT(data_offset_, message->main_buffer_size());
DCHECK_LE(bytes_to_write, message->main_buffer_size());
Buffer buffer = {
static_cast<const char*>(message->main_buffer()) + data_offset_,
bytes_to_write};
......@@ -117,9 +117,9 @@ void RawChannel::WriteBuffer::GetBuffers(std::vector<Buffer>* buffers) const {
if (data_offset_ >= message->main_buffer_size()) {
// Only write from the transport data buffer.
CHECK_LT(data_offset_ - message->main_buffer_size(),
DCHECK_LT(data_offset_ - message->main_buffer_size(),
transport_data_buffer_size);
CHECK_LE(bytes_to_write, transport_data_buffer_size);
DCHECK_LE(bytes_to_write, transport_data_buffer_size);
Buffer buffer = {
static_cast<const char*>(message->transport_data()->buffer()) +
(data_offset_ - message->main_buffer_size()),
......@@ -133,7 +133,7 @@ void RawChannel::WriteBuffer::GetBuffers(std::vector<Buffer>* buffers) const {
// attached.
// Write from both buffers.
CHECK_EQ(
DCHECK_EQ(
bytes_to_write,
message->main_buffer_size() - data_offset_ + transport_data_buffer_size);
Buffer buffer1 = {
......@@ -157,30 +157,30 @@ RawChannel::RawChannel()
}
RawChannel::~RawChannel() {
CHECK(!read_buffer_);
CHECK(!write_buffer_);
DCHECK(!read_buffer_);
DCHECK(!write_buffer_);
// No need to take the |write_lock_| here -- if there are still weak pointers
// outstanding, then we're hosed anyway (since we wouldn't be able to
// invalidate them cleanly, since we might not be on the I/O thread).
CHECK(!weak_ptr_factory_.HasWeakPtrs());
DCHECK(!weak_ptr_factory_.HasWeakPtrs());
}
bool RawChannel::Init(Delegate* delegate) {
CHECK(delegate);
DCHECK(delegate);
CHECK(!delegate_);
DCHECK(!delegate_);
delegate_ = delegate;
CHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_IO);
CHECK(!message_loop_for_io_);
DCHECK(!message_loop_for_io_);
message_loop_for_io_ =
static_cast<base::MessageLoopForIO*>(base::MessageLoop::current());
// No need to take the lock. No one should be using us yet.
CHECK(!read_buffer_);
DCHECK(!read_buffer_);
read_buffer_.reset(new ReadBuffer);
CHECK(!write_buffer_);
DCHECK(!write_buffer_);
write_buffer_.reset(new WriteBuffer(GetSerializedPlatformHandleSize()));
if (!OnInit()) {
......@@ -207,7 +207,7 @@ bool RawChannel::Init(Delegate* delegate) {
}
void RawChannel::Shutdown() {
CHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
base::AutoLock locker(write_lock_);
......@@ -225,7 +225,7 @@ void RawChannel::Shutdown() {
// Reminder: This must be thread-safe.
bool RawChannel::WriteMessage(scoped_ptr<MessageInTransit> message) {
CHECK(message);
DCHECK(message);
base::AutoLock locker(write_lock_);
if (write_stopped_)
......@@ -237,7 +237,7 @@ bool RawChannel::WriteMessage(scoped_ptr<MessageInTransit> message) {
}
EnqueueMessageNoLock(message.Pass());
CHECK_EQ(write_buffer_->data_offset_, 0u);
DCHECK_EQ(write_buffer_->data_offset_, 0u);
size_t platform_handles_written = 0;
size_t bytes_written = 0;
......@@ -266,7 +266,7 @@ bool RawChannel::IsWriteBufferEmpty() {
}
void RawChannel::OnReadCompleted(bool result, size_t bytes_read) {
CHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
if (read_stopped_) {
NOTREACHED();
......@@ -310,12 +310,12 @@ void RawChannel::OnReadCompleted(bool result, size_t bytes_read) {
remaining_bytes >= message_size) {
MessageInTransit::View message_view(
message_size, &read_buffer_->buffer_[read_buffer_start]);
CHECK_EQ(message_view.total_size(), message_size);
DCHECK_EQ(message_view.total_size(), message_size);
const char* error_message = NULL;
if (!message_view.IsValid(GetSerializedPlatformHandleSize(),
&error_message)) {
CHECK(error_message);
DCHECK(error_message);
LOG(WARNING) << "Received invalid message: " << error_message;
read_stopped_ = true;
CallOnFatalError(Delegate::FATAL_ERROR_READ);
......@@ -355,7 +355,7 @@ void RawChannel::OnReadCompleted(bool result, size_t bytes_read) {
// for the POSIX implementation, we should confirm that none are stored.
// Dispatch the message.
CHECK(delegate_);
DCHECK(delegate_);
delegate_->OnReadMessage(message_view, platform_handles.Pass());
if (read_stopped_) {
// |Shutdown()| was called in |OnReadMessage()|.
......@@ -413,12 +413,12 @@ void RawChannel::OnReadCompleted(bool result, size_t bytes_read) {
void RawChannel::OnWriteCompleted(bool result,
size_t platform_handles_written,
size_t bytes_written) {
CHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
bool did_fail = false;
{
base::AutoLock locker(write_lock_);
CHECK_EQ(write_stopped_, write_buffer_->message_queue_.empty());
DCHECK_EQ(write_stopped_, write_buffer_->message_queue_.empty());
if (write_stopped_) {
NOTREACHED();
......@@ -447,7 +447,7 @@ bool RawChannel::OnReadMessageForRawChannel(
}
void RawChannel::CallOnFatalError(Delegate::FatalError fatal_error) {
CHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
// TODO(vtl): Add a "write_lock_.AssertNotAcquired()"?
if (delegate_)
delegate_->OnFatalError(fatal_error);
......@@ -458,8 +458,8 @@ bool RawChannel::OnWriteCompletedNoLock(bool result,
size_t bytes_written) {
write_lock_.AssertAcquired();
CHECK(!write_stopped_);
CHECK(!write_buffer_->message_queue_.empty());
DCHECK(!write_stopped_);
DCHECK(!write_buffer_->message_queue_.empty());
if (result) {
write_buffer_->platform_handles_offset_ += platform_handles_written;
......@@ -468,7 +468,7 @@ bool RawChannel::OnWriteCompletedNoLock(bool result,
MessageInTransit* message = write_buffer_->message_queue_.front();
if (write_buffer_->data_offset_ >= message->total_size()) {
// Complete write.
CHECK_EQ(write_buffer_->data_offset_, message->total_size());
DCHECK_EQ(write_buffer_->data_offset_, message->total_size());
write_buffer_->message_queue_.pop_front();
delete message;
write_buffer_->platform_handles_offset_ = 0;
......@@ -482,7 +482,7 @@ bool RawChannel::OnWriteCompletedNoLock(bool result,
IOResult io_result = ScheduleWriteNoLock();
if (io_result == IO_PENDING)
return true;
CHECK_EQ(io_result, IO_FAILED);
DCHECK_EQ(io_result, IO_FAILED);
}
write_stopped_ = true;
......
......@@ -9,7 +9,6 @@
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/debug/alias.h"
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/logging.h"
......@@ -89,30 +88,6 @@ class RawChannelWin : public RawChannel {
// - there is no pending write.
class RawChannelIOHandler : public base::MessageLoopForIO::IOHandler {
public:
// TODO(yzshen): This is for debugging http://crbug.com/385795.
// This code should be removed once the issue is fixed or nothing is
// revealed by it. (No later than Aug 1, 2014.)
struct WriteStats {
WriteStats()
: write_no_lock_call(0),
schedule_write_no_lock_call(0),
os_write_call(0),
os_write_pending(0),
os_write_failure(0),
task_posted_by_schedule_write(0),
write_completion(0),
write_completion_failure(0) {}
uint32_t write_no_lock_call;
uint32_t schedule_write_no_lock_call;
uint32_t os_write_call;
uint32_t os_write_pending;
uint32_t os_write_failure;
uint32_t task_posted_by_schedule_write;
uint32_t write_completion;
uint32_t write_completion_failure;
};
RawChannelIOHandler(RawChannelWin* owner,
embedder::ScopedPlatformHandle handle);
......@@ -130,7 +105,6 @@ class RawChannelWin : public RawChannel {
base::MessageLoopForIO::IOContext* write_context_no_lock();
// Instructs the object to wait for an |OnIOCompleted()| notification.
void OnPendingWriteStartedNoLock();
WriteStats* write_stats_no_lock();
// |base::MessageLoopForIO::IOHandler| implementation:
// Must be called on the I/O thread. It could be called before or after
......@@ -182,8 +156,6 @@ class RawChannelWin : public RawChannel {
bool pending_write_;
base::MessageLoopForIO::IOContext write_context_;
WriteStats write_stats_;
DISALLOW_COPY_AND_ASSIGN(RawChannelIOHandler);
};
......@@ -227,73 +199,54 @@ RawChannelWin::RawChannelIOHandler::RawChannelIOHandler(
}
RawChannelWin::RawChannelIOHandler::~RawChannelIOHandler() {
CHECK(ShouldSelfDestruct());
VLOG(4) << "write_no_lock_call: " << write_stats_.write_no_lock_call << "\n"
<< "schedule_write_no_lock_call: "
<< write_stats_.schedule_write_no_lock_call << "\n"
<< "os_write_call: " << write_stats_.os_write_call << "\n"
<< "os_write_pending: " << write_stats_.os_write_pending << "\n"
<< "os_write_failure: " << write_stats_.os_write_failure << "\n"
<< "task_posted_by_schedule_write: "
<< write_stats_.task_posted_by_schedule_write << "\n"
<< "write_completion: " << write_stats_.write_completion << "\n"
<< "write_completion_failure: "
<< write_stats_.write_completion_failure << "\n";
DCHECK(ShouldSelfDestruct());
}
bool RawChannelWin::RawChannelIOHandler::pending_read() const {
CHECK(owner_);
CHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
DCHECK(owner_);
DCHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
return pending_read_;
}
base::MessageLoopForIO::IOContext*
RawChannelWin::RawChannelIOHandler::read_context() {
CHECK(owner_);
CHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
DCHECK(owner_);
DCHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
return &read_context_;
}
void RawChannelWin::RawChannelIOHandler::OnPendingReadStarted() {
CHECK(owner_);
CHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
CHECK(!pending_read_);
DCHECK(owner_);
DCHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
DCHECK(!pending_read_);
pending_read_ = true;
}
bool RawChannelWin::RawChannelIOHandler::pending_write_no_lock() const {
CHECK(owner_);
DCHECK(owner_);
owner_->write_lock().AssertAcquired();
return pending_write_;
}
base::MessageLoopForIO::IOContext*
RawChannelWin::RawChannelIOHandler::write_context_no_lock() {
CHECK(owner_);
DCHECK(owner_);
owner_->write_lock().AssertAcquired();
return &write_context_;
}
void RawChannelWin::RawChannelIOHandler::OnPendingWriteStartedNoLock() {
CHECK(owner_);
DCHECK(owner_);
owner_->write_lock().AssertAcquired();
CHECK(!pending_write_);
DCHECK(!pending_write_);
pending_write_ = true;
}
RawChannelWin::RawChannelIOHandler::WriteStats*
RawChannelWin::RawChannelIOHandler::write_stats_no_lock() {
CHECK(owner_);
owner_->write_lock().AssertAcquired();
return &write_stats_;
}
void RawChannelWin::RawChannelIOHandler::OnIOCompleted(
base::MessageLoopForIO::IOContext* context,
DWORD bytes_transferred,
DWORD error) {
CHECK(!owner_ ||
DCHECK(!owner_ ||
base::MessageLoop::current() == owner_->message_loop_for_io());
{
......@@ -316,8 +269,8 @@ void RawChannelWin::RawChannelIOHandler::OnIOCompleted(
void RawChannelWin::RawChannelIOHandler::DetachFromOwnerNoLock(
scoped_ptr<ReadBuffer> read_buffer,
scoped_ptr<WriteBuffer> write_buffer) {
CHECK(owner_);
CHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
DCHECK(owner_);
DCHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
owner_->write_lock().AssertAcquired();
// If read/write is pending, we have to retain the corresponding buffer.
......@@ -341,9 +294,9 @@ bool RawChannelWin::RawChannelIOHandler::ShouldSelfDestruct() const {
void RawChannelWin::RawChannelIOHandler::OnReadCompleted(DWORD bytes_read,
DWORD error) {
CHECK(!owner_ ||
DCHECK(!owner_ ||
base::MessageLoop::current() == owner_->message_loop_for_io());
CHECK(suppress_self_destruct_);
DCHECK(suppress_self_destruct_);
CHECK(pending_read_);
pending_read_ = false;
......@@ -351,33 +304,24 @@ void RawChannelWin::RawChannelIOHandler::OnReadCompleted(DWORD bytes_read,
return;
if (error != ERROR_SUCCESS) {
CHECK_EQ(bytes_read, 0u);
DCHECK_EQ(bytes_read, 0u);
LOG_IF(ERROR, error != ERROR_BROKEN_PIPE)
<< "ReadFile: " << logging::SystemErrorCodeToString(error);
owner_->OnReadCompleted(false, 0);
} else {
CHECK_GT(bytes_read, 0u);
DCHECK_GT(bytes_read, 0u);
owner_->OnReadCompleted(true, bytes_read);
}
}
void RawChannelWin::RawChannelIOHandler::OnWriteCompleted(DWORD bytes_written,
DWORD error) {
CHECK(!owner_ ||
DCHECK(!owner_ ||
base::MessageLoop::current() == owner_->message_loop_for_io());
CHECK(suppress_self_destruct_);
WriteStats stack_copy;
base::debug::Alias(&stack_copy);
DCHECK(suppress_self_destruct_);
if (!owner_) {
// No lock needed.
write_stats_.write_completion++;
if (error != ERROR_SUCCESS)
write_stats_.write_completion_failure++;
stack_copy = write_stats_;
CHECK(pending_write_);
pending_write_ = false;
return;
......@@ -385,12 +329,6 @@ void RawChannelWin::RawChannelIOHandler::OnWriteCompleted(DWORD bytes_written,
{
base::AutoLock locker(owner_->write_lock());
write_stats_.write_completion++;
if (error != ERROR_SUCCESS)
write_stats_.write_completion_failure++;
stack_copy = write_stats_;
CHECK(pending_write_);
pending_write_ = false;
}
......@@ -408,11 +346,11 @@ RawChannelWin::RawChannelWin(embedder::ScopedPlatformHandle handle)
io_handler_(NULL),
skip_completion_port_on_success_(
g_vista_or_higher_functions.Get().is_vista_or_higher()) {
CHECK(handle_.is_valid());
DCHECK(handle_.is_valid());
}
RawChannelWin::~RawChannelWin() {
CHECK(!io_handler_);
DCHECK(!io_handler_);
}
size_t RawChannelWin::GetSerializedPlatformHandleSize() const {
......@@ -421,9 +359,9 @@ size_t RawChannelWin::GetSerializedPlatformHandleSize() const {
}
RawChannel::IOResult RawChannelWin::Read(size_t* bytes_read) {
CHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
CHECK(io_handler_);
CHECK(!io_handler_->pending_read());
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
DCHECK(io_handler_);
DCHECK(!io_handler_->pending_read());
char* buffer = NULL;
size_t bytes_to_read = 0;
......@@ -436,7 +374,7 @@ RawChannel::IOResult RawChannelWin::Read(size_t* bytes_read) {
&bytes_read_dword,
&io_handler_->read_context()->overlapped);
if (!result) {
CHECK_EQ(bytes_read_dword, 0u);
DCHECK_EQ(bytes_read_dword, 0u);
DWORD error = GetLastError();
if (error != ERROR_IO_PENDING) {
LOG_IF(ERROR, error != ERROR_BROKEN_PIPE)
......@@ -464,14 +402,14 @@ RawChannel::IOResult RawChannelWin::Read(size_t* bytes_read) {
}
RawChannel::IOResult RawChannelWin::ScheduleRead() {
CHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
CHECK(io_handler_);
CHECK(!io_handler_->pending_read());
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
DCHECK(io_handler_);
DCHECK(!io_handler_->pending_read());
size_t bytes_read = 0;
IOResult io_result = Read(&bytes_read);
if (io_result == IO_SUCCEEDED) {
CHECK(skip_completion_port_on_success_);
DCHECK(skip_completion_port_on_success_);
// We have finished reading successfully. Queue a notification manually.
io_handler_->OnPendingReadStarted();
......@@ -503,15 +441,8 @@ RawChannel::IOResult RawChannelWin::WriteNoLock(
size_t* bytes_written) {
write_lock().AssertAcquired();
RawChannelIOHandler::WriteStats stack_copy(
*io_handler_->write_stats_no_lock());
base::debug::Alias(&stack_copy);
io_handler_->write_stats_no_lock()->write_no_lock_call++;
stack_copy.write_no_lock_call++;
CHECK(io_handler_);
CHECK(!io_handler_->pending_write_no_lock());
DCHECK(io_handler_);
DCHECK(!io_handler_->pending_write_no_lock());
if (write_buffer_no_lock()->HavePlatformHandlesToSend()) {
// TODO(vtl): Implement.
......@@ -520,10 +451,7 @@ RawChannel::IOResult RawChannelWin::WriteNoLock(
std::vector<WriteBuffer::Buffer> buffers;
write_buffer_no_lock()->GetBuffers(&buffers);
CHECK(!buffers.empty());
io_handler_->write_stats_no_lock()->os_write_call++;
stack_copy.os_write_call++;
DCHECK(!buffers.empty());
// TODO(yzshen): Handle multi-segment writes more efficiently.
DWORD bytes_written_dword = 0;
......@@ -532,19 +460,10 @@ RawChannel::IOResult RawChannelWin::WriteNoLock(
static_cast<DWORD>(buffers[0].size),
&bytes_written_dword,
&io_handler_->write_context_no_lock()->overlapped);
if (!result) {
if (GetLastError() == ERROR_IO_PENDING) {
io_handler_->write_stats_no_lock()->os_write_pending++;
stack_copy.os_write_pending++;
} else {
io_handler_->write_stats_no_lock()->os_write_failure++;
stack_copy.os_write_failure++;
if (!result && GetLastError() != ERROR_IO_PENDING) {
PLOG(ERROR) << "WriteFile";
return IO_FAILED;
}
}
if (result && skip_completion_port_on_success_) {
*platform_handles_written = 0;
......@@ -568,29 +487,18 @@ RawChannel::IOResult RawChannelWin::WriteNoLock(
RawChannel::IOResult RawChannelWin::ScheduleWriteNoLock() {
write_lock().AssertAcquired();
RawChannelIOHandler::WriteStats stack_copy(
*io_handler_->write_stats_no_lock());
base::debug::Alias(&stack_copy);
io_handler_->write_stats_no_lock()->schedule_write_no_lock_call++;
stack_copy.schedule_write_no_lock_call++;
CHECK(io_handler_);
CHECK(!io_handler_->pending_write_no_lock());
DCHECK(io_handler_);
DCHECK(!io_handler_->pending_write_no_lock());
// TODO(vtl): Do something with |platform_handles_written|.
size_t platform_handles_written = 0;
size_t bytes_written = 0;
IOResult io_result = WriteNoLock(&platform_handles_written, &bytes_written);
if (io_result == IO_SUCCEEDED) {
CHECK(skip_completion_port_on_success_);
DCHECK(skip_completion_port_on_success_);
// We have finished writing successfully. Queue a notification manually.
io_handler_->OnPendingWriteStartedNoLock();
io_handler_->write_stats_no_lock()->task_posted_by_schedule_write++;
stack_copy.task_posted_by_schedule_write++;
// |io_handler_| won't go away before that task is run, so it is safe to use
// |base::Unretained()|.
message_loop_for_io()->PostTask(
......@@ -607,16 +515,16 @@ RawChannel::IOResult RawChannelWin::ScheduleWriteNoLock() {
}
bool RawChannelWin::OnInit() {
CHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
CHECK(handle_.is_valid());
DCHECK(handle_.is_valid());
if (skip_completion_port_on_success_ &&
!g_vista_or_higher_functions.Get().SetFileCompletionNotificationModes(
handle_.get().handle, FILE_SKIP_COMPLETION_PORT_ON_SUCCESS)) {
return false;
}
CHECK(!io_handler_);
DCHECK(!io_handler_);
io_handler_ = new RawChannelIOHandler(this, handle_.Pass());
return true;
......@@ -624,8 +532,8 @@ bool RawChannelWin::OnInit() {
void RawChannelWin::OnShutdownNoLock(scoped_ptr<ReadBuffer> read_buffer,
scoped_ptr<WriteBuffer> write_buffer) {
CHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
CHECK(io_handler_);
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
DCHECK(io_handler_);
write_lock().AssertAcquired();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment