OLD | NEW |
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 "base/memory/weak_ptr.h" | 5 #include "base/memory/weak_ptr.h" |
6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 369 } |
370 | 370 |
371 explicit AdbParser(const SimpleHttpServer::SendCallback& callback) | 371 explicit AdbParser(const SimpleHttpServer::SendCallback& callback) |
372 : callback_(callback) { | 372 : callback_(callback) { |
373 } | 373 } |
374 | 374 |
375 virtual ~AdbParser() { | 375 virtual ~AdbParser() { |
376 } | 376 } |
377 | 377 |
378 private: | 378 private: |
379 virtual int Consume(const char* data, int size) OVERRIDE { | 379 virtual int Consume(const char* data, int size) override { |
380 CHECK(CalledOnValidThread()); | 380 CHECK(CalledOnValidThread()); |
381 if (!selected_socket_.empty()) { | 381 if (!selected_socket_.empty()) { |
382 std::string message(data, size); | 382 std::string message(data, size); |
383 size_t request_end_pos = message.find(kHttpRequestTerminator); | 383 size_t request_end_pos = message.find(kHttpRequestTerminator); |
384 if (request_end_pos != std::string::npos) { | 384 if (request_end_pos != std::string::npos) { |
385 ProcessHTTPRequest(message.substr(0, request_end_pos)); | 385 ProcessHTTPRequest(message.substr(0, request_end_pos)); |
386 return request_end_pos + strlen(kHttpRequestTerminator); | 386 return request_end_pos + strlen(kHttpRequestTerminator); |
387 } | 387 } |
388 return 0; | 388 return 0; |
389 } | 389 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 | 540 |
541 void StopMockAdbServer() { | 541 void StopMockAdbServer() { |
542 BrowserThread::PostTaskAndReply( | 542 BrowserThread::PostTaskAndReply( |
543 BrowserThread::IO, | 543 BrowserThread::IO, |
544 FROM_HERE, | 544 FROM_HERE, |
545 base::Bind(&StopMockAdbServerOnIOThread), | 545 base::Bind(&StopMockAdbServerOnIOThread), |
546 base::MessageLoop::QuitClosure()); | 546 base::MessageLoop::QuitClosure()); |
547 content::RunMessageLoop(); | 547 content::RunMessageLoop(); |
548 } | 548 } |
549 | 549 |
OLD | NEW |