| 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 <stddef.h> |
| 9 #include <stdint.h> |
| 8 #include <unistd.h> | 10 #include <unistd.h> |
| 9 #include <string> | 11 #include <string> |
| 10 #include <vector> | 12 #include <vector> |
| 11 | 13 |
| 12 #include "base/bind.h" | 14 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
| 14 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 15 #include "base/location.h" | 17 #include "base/location.h" |
| 18 #include "base/macros.h" |
| 16 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
| 17 #include "base/posix/eintr_wrapper.h" | 20 #include "base/posix/eintr_wrapper.h" |
| 18 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 19 #include "base/task_runner_util.h" | 22 #include "base/task_runner_util.h" |
| 20 #include "chromeos/dbus/pipe_reader.h" | 23 #include "chromeos/dbus/pipe_reader.h" |
| 21 #include "dbus/bus.h" | 24 #include "dbus/bus.h" |
| 22 #include "dbus/message.h" | 25 #include "dbus/message.h" |
| 23 #include "dbus/object_path.h" | 26 #include "dbus/object_path.h" |
| 24 #include "dbus/object_proxy.h" | 27 #include "dbus/object_proxy.h" |
| 25 | 28 |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 dbus::Response* response) { | 460 dbus::Response* response) { |
| 458 if (!response) | 461 if (!response) |
| 459 return; | 462 return; |
| 460 | 463 |
| 461 dbus::MessageReader reader(response); | 464 dbus::MessageReader reader(response); |
| 462 | 465 |
| 463 int status = 0; | 466 int status = 0; |
| 464 if (!reader.PopInt32(&status)) | 467 if (!reader.PopInt32(&status)) |
| 465 return; | 468 return; |
| 466 | 469 |
| 467 const uint8* buffer = nullptr; | 470 const uint8_t* buffer = nullptr; |
| 468 size_t buf_size = 0; | 471 size_t buf_size = 0; |
| 469 | 472 |
| 470 if (!reader.PopArrayOfBytes(&buffer, &buf_size)) | 473 if (!reader.PopArrayOfBytes(&buffer, &buf_size)) |
| 471 return; | 474 return; |
| 472 std::vector<uint8> perf_data; | 475 std::vector<uint8_t> perf_data; |
| 473 if (buf_size > 0) | 476 if (buf_size > 0) |
| 474 perf_data.insert(perf_data.end(), buffer, buffer + buf_size); | 477 perf_data.insert(perf_data.end(), buffer, buffer + buf_size); |
| 475 | 478 |
| 476 if (!reader.PopArrayOfBytes(&buffer, &buf_size)) | 479 if (!reader.PopArrayOfBytes(&buffer, &buf_size)) |
| 477 return; | 480 return; |
| 478 std::vector<uint8> perf_stat; | 481 std::vector<uint8_t> perf_stat; |
| 479 if (buf_size > 0) | 482 if (buf_size > 0) |
| 480 perf_stat.insert(perf_stat.end(), buffer, buffer + buf_size); | 483 perf_stat.insert(perf_stat.end(), buffer, buffer + buf_size); |
| 481 | 484 |
| 482 callback.Run(status, perf_data, perf_stat); | 485 callback.Run(status, perf_data, perf_stat); |
| 483 } | 486 } |
| 484 | 487 |
| 485 void OnGetAllLogs(const GetLogsCallback& callback, | 488 void OnGetAllLogs(const GetLogsCallback& callback, |
| 486 dbus::Response* response) { | 489 dbus::Response* response) { |
| 487 std::map<std::string, std::string> logs; | 490 std::map<std::string, std::string> logs; |
| 488 bool broken = false; // did we see a broken (k,v) pair? | 491 bool broken = false; // did we see a broken (k,v) pair? |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 529 |
| 527 callback.Run(response != NULL); | 530 callback.Run(response != NULL); |
| 528 } | 531 } |
| 529 | 532 |
| 530 void OnQueryDebuggingFeatures( | 533 void OnQueryDebuggingFeatures( |
| 531 const QueryDevFeaturesCallback& callback, | 534 const QueryDevFeaturesCallback& callback, |
| 532 dbus::Response* response) { | 535 dbus::Response* response) { |
| 533 if (callback.is_null()) | 536 if (callback.is_null()) |
| 534 return; | 537 return; |
| 535 | 538 |
| 536 int32 feature_mask = DEV_FEATURE_NONE; | 539 int32_t feature_mask = DEV_FEATURE_NONE; |
| 537 if (!response || !dbus::MessageReader(response).PopInt32(&feature_mask)) { | 540 if (!response || !dbus::MessageReader(response).PopInt32(&feature_mask)) { |
| 538 callback.Run(false, debugd::DevFeatureFlag::DEV_FEATURES_DISABLED); | 541 callback.Run(false, debugd::DevFeatureFlag::DEV_FEATURES_DISABLED); |
| 539 return; | 542 return; |
| 540 } | 543 } |
| 541 | 544 |
| 542 callback.Run(true, feature_mask); | 545 callback.Run(true, feature_mask); |
| 543 } | 546 } |
| 544 | 547 |
| 545 void OnRemoveRootfsVerification( | 548 void OnRemoveRootfsVerification( |
| 546 const EnableDebuggingCallback& callback, | 549 const EnableDebuggingCallback& callback, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 DebugDaemonClient::EmptyStopAgentTracingCallback() { | 641 DebugDaemonClient::EmptyStopAgentTracingCallback() { |
| 639 return base::Bind(&EmptyStopAgentTracingCallbackBody); | 642 return base::Bind(&EmptyStopAgentTracingCallbackBody); |
| 640 } | 643 } |
| 641 | 644 |
| 642 // static | 645 // static |
| 643 DebugDaemonClient* DebugDaemonClient::Create() { | 646 DebugDaemonClient* DebugDaemonClient::Create() { |
| 644 return new DebugDaemonClientImpl(); | 647 return new DebugDaemonClientImpl(); |
| 645 } | 648 } |
| 646 | 649 |
| 647 } // namespace chromeos | 650 } // namespace chromeos |
| OLD | NEW |