| OLD | NEW |
| 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 "chromeos/dbus/debug_daemon_client.h" | 5 #include "chromeos/dbus/debug_daemon_client.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 507 |
| 508 void OnGetPerfData(const GetPerfDataCallback& callback, | 508 void OnGetPerfData(const GetPerfDataCallback& callback, |
| 509 dbus::Response* response) { | 509 dbus::Response* response) { |
| 510 std::vector<uint8> data; | 510 std::vector<uint8> data; |
| 511 | 511 |
| 512 if (!response) { | 512 if (!response) { |
| 513 return; | 513 return; |
| 514 } | 514 } |
| 515 | 515 |
| 516 dbus::MessageReader reader(response); | 516 dbus::MessageReader reader(response); |
| 517 uint8* buffer = NULL; | 517 const uint8* buffer = NULL; |
| 518 size_t buf_size = 0; | 518 size_t buf_size = 0; |
| 519 if (!reader.PopArrayOfBytes(reinterpret_cast<uint8**>( | 519 if (!reader.PopArrayOfBytes(&buffer, &buf_size)) |
| 520 &buffer), &buf_size)) { | |
| 521 return; | 520 return; |
| 522 } | |
| 523 | 521 |
| 524 // TODO(asharif): Figure out a way to avoid this copy. | 522 // TODO(asharif): Figure out a way to avoid this copy. |
| 525 data.insert(data.end(), buffer, buffer + buf_size); | 523 data.insert(data.end(), buffer, buffer + buf_size); |
| 526 | 524 |
| 527 callback.Run(data); | 525 callback.Run(data); |
| 528 } | 526 } |
| 529 | 527 |
| 530 void OnGetAllLogs(const GetLogsCallback& callback, | 528 void OnGetAllLogs(const GetLogsCallback& callback, |
| 531 dbus::Response* response) { | 529 dbus::Response* response) { |
| 532 std::map<std::string, std::string> logs; | 530 std::map<std::string, std::string> logs; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 DebugDaemonClient::EmptyStopSystemTracingCallback() { | 629 DebugDaemonClient::EmptyStopSystemTracingCallback() { |
| 632 return base::Bind(&EmptyStopSystemTracingCallbackBody); | 630 return base::Bind(&EmptyStopSystemTracingCallbackBody); |
| 633 } | 631 } |
| 634 | 632 |
| 635 // static | 633 // static |
| 636 DebugDaemonClient* DebugDaemonClient::Create() { | 634 DebugDaemonClient* DebugDaemonClient::Create() { |
| 637 return new DebugDaemonClientImpl(); | 635 return new DebugDaemonClientImpl(); |
| 638 } | 636 } |
| 639 | 637 |
| 640 } // namespace chromeos | 638 } // namespace chromeos |
| OLD | NEW |