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

Side by Side Diff: chrome/browser/devtools/device/adb/mock_adb_server.cc

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/devtools/device/adb/mock_adb_server.h" 5 #include "chrome/browser/devtools/device/adb/mock_adb_server.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 input_buffer_->set_offset(data_size - bytes_processed); 322 input_buffer_->set_offset(data_size - bytes_processed);
323 } 323 }
324 } while (bytes_processed); 324 } while (bytes_processed);
325 // Posting to avoid deep recursion in case of synchronous IO 325 // Posting to avoid deep recursion in case of synchronous IO
326 base::ThreadTaskRunnerHandle::Get()->PostTask( 326 base::ThreadTaskRunnerHandle::Get()->PostTask(
327 FROM_HERE, base::Bind(&Connection::ReadData, weak_factory_.GetWeakPtr())); 327 FROM_HERE, base::Bind(&Connection::ReadData, weak_factory_.GetWeakPtr()));
328 } 328 }
329 329
330 void SimpleHttpServer::Connection::WriteData() { 330 void SimpleHttpServer::Connection::WriteData() {
331 CHECK(CalledOnValidThread()); 331 CHECK(CalledOnValidThread());
332 // Check for overflow.
332 CHECK_GE(output_buffer_->capacity(), 333 CHECK_GE(output_buffer_->capacity(),
333 output_buffer_->offset() + bytes_to_write_) << "Overflow"; 334 output_buffer_->offset() + bytes_to_write_);
334 335
335 int write_result = socket_->Write( 336 int write_result = socket_->Write(
336 output_buffer_.get(), 337 output_buffer_.get(),
337 bytes_to_write_, 338 bytes_to_write_,
338 base::Bind(&Connection::OnDataWritten, base::Unretained(this))); 339 base::Bind(&Connection::OnDataWritten, base::Unretained(this)));
339 340
340 if (write_result != net::ERR_IO_PENDING) 341 if (write_result != net::ERR_IO_PENDING)
341 OnDataWritten(write_result); 342 OnDataWritten(write_result);
342 } 343 }
343 344
344 void SimpleHttpServer::Connection::OnDataWritten(int count) { 345 void SimpleHttpServer::Connection::OnDataWritten(int count) {
345 CHECK(CalledOnValidThread()); 346 CHECK(CalledOnValidThread());
346 if (count < 0) { 347 if (count < 0) {
347 delete this; 348 delete this;
348 return; 349 return;
349 } 350 }
350 CHECK_GT(count, 0); 351 CHECK_GT(count, 0);
352 // Check for overflow.
351 CHECK_GE(output_buffer_->capacity(), 353 CHECK_GE(output_buffer_->capacity(),
352 output_buffer_->offset() + bytes_to_write_) << "Overflow"; 354 output_buffer_->offset() + bytes_to_write_);
353 355
354 bytes_to_write_ -= count; 356 bytes_to_write_ -= count;
355 output_buffer_->set_offset(output_buffer_->offset() + count); 357 output_buffer_->set_offset(output_buffer_->offset() + count);
356 358
357 if (bytes_to_write_ != 0) 359 if (bytes_to_write_ != 0)
358 // Posting to avoid deep recursion in case of synchronous IO 360 // Posting to avoid deep recursion in case of synchronous IO
359 base::ThreadTaskRunnerHandle::Get()->PostTask( 361 base::ThreadTaskRunnerHandle::Get()->PostTask(
360 FROM_HERE, 362 FROM_HERE,
361 base::Bind(&Connection::WriteData, weak_factory_.GetWeakPtr())); 363 base::Bind(&Connection::WriteData, weak_factory_.GetWeakPtr()));
362 else if (read_closed_) 364 else if (read_closed_)
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 content::RunMessageLoop(); 616 content::RunMessageLoop();
615 } 617 }
616 618
617 void StopMockAdbServer() { 619 void StopMockAdbServer() {
618 BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, 620 BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE,
619 base::Bind(&StopMockAdbServerOnIOThread), 621 base::Bind(&StopMockAdbServerOnIOThread),
620 base::MessageLoop::QuitWhenIdleClosure()); 622 base::MessageLoop::QuitWhenIdleClosure());
621 content::RunMessageLoop(); 623 content::RunMessageLoop();
622 } 624 }
623 625
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698