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

Side by Side Diff: chromeos/dbus/power_manager_client.cc

Issue 438433002: Add dark resume methods to PowerManagerClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and update FakePowerManagerClient Created 6 years, 4 months 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 (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/power_manager_client.h" 5 #include "chromeos/dbus/power_manager_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 30 matching lines...) Expand all
41 const char kSuspendDelayDescription[] = "chrome"; 41 const char kSuspendDelayDescription[] = "chrome";
42 42
43 // The PowerManagerClient implementation used in production. 43 // The PowerManagerClient implementation used in production.
44 class PowerManagerClientImpl : public PowerManagerClient { 44 class PowerManagerClientImpl : public PowerManagerClient {
45 public: 45 public:
46 PowerManagerClientImpl() 46 PowerManagerClientImpl()
47 : origin_thread_id_(base::PlatformThread::CurrentId()), 47 : origin_thread_id_(base::PlatformThread::CurrentId()),
48 power_manager_proxy_(NULL), 48 power_manager_proxy_(NULL),
49 suspend_delay_id_(-1), 49 suspend_delay_id_(-1),
50 has_suspend_delay_id_(false), 50 has_suspend_delay_id_(false),
51 dark_suspend_delay_id_(-1),
52 has_dark_suspend_delay_id_(false),
51 pending_suspend_id_(-1), 53 pending_suspend_id_(-1),
52 suspend_is_pending_(false), 54 suspend_is_pending_(false),
55 suspending_from_dark_resume_(false),
53 num_pending_suspend_readiness_callbacks_(0), 56 num_pending_suspend_readiness_callbacks_(0),
54 last_is_projecting_(false), 57 last_is_projecting_(false),
55 weak_ptr_factory_(this) {} 58 weak_ptr_factory_(this) {}
56 59
57 virtual ~PowerManagerClientImpl() { 60 virtual ~PowerManagerClientImpl() {
58 // Here we should unregister suspend notifications from powerd, 61 // Here we should unregister suspend notifications from powerd,
59 // however: 62 // however:
60 // - The lifetime of the PowerManagerClientImpl can extend past that of 63 // - The lifetime of the PowerManagerClientImpl can extend past that of
61 // the objectproxy, 64 // the objectproxy,
62 // - power_manager can already detect that the client is gone and 65 // - power_manager can already detect that the client is gone and
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 power_manager_proxy_->ConnectToSignal( 281 power_manager_proxy_->ConnectToSignal(
279 power_manager::kPowerManagerInterface, 282 power_manager::kPowerManagerInterface,
280 power_manager::kSuspendDoneSignal, 283 power_manager::kSuspendDoneSignal,
281 base::Bind(&PowerManagerClientImpl::SuspendDoneReceived, 284 base::Bind(&PowerManagerClientImpl::SuspendDoneReceived,
282 weak_ptr_factory_.GetWeakPtr()), 285 weak_ptr_factory_.GetWeakPtr()),
283 base::Bind(&PowerManagerClientImpl::SignalConnected, 286 base::Bind(&PowerManagerClientImpl::SignalConnected,
284 weak_ptr_factory_.GetWeakPtr())); 287 weak_ptr_factory_.GetWeakPtr()));
285 288
286 power_manager_proxy_->ConnectToSignal( 289 power_manager_proxy_->ConnectToSignal(
287 power_manager::kPowerManagerInterface, 290 power_manager::kPowerManagerInterface,
291 power_manager::kDarkSuspendImminentSignal,
292 base::Bind(
293 &PowerManagerClientImpl::DarkSuspendImminentReceived,
294 weak_ptr_factory_.GetWeakPtr()),
295 base::Bind(&PowerManagerClientImpl::SignalConnected,
296 weak_ptr_factory_.GetWeakPtr()));
297
298 power_manager_proxy_->ConnectToSignal(
299 power_manager::kPowerManagerInterface,
288 power_manager::kIdleActionImminentSignal, 300 power_manager::kIdleActionImminentSignal,
289 base::Bind( 301 base::Bind(
290 &PowerManagerClientImpl::IdleActionImminentReceived, 302 &PowerManagerClientImpl::IdleActionImminentReceived,
291 weak_ptr_factory_.GetWeakPtr()), 303 weak_ptr_factory_.GetWeakPtr()),
292 base::Bind(&PowerManagerClientImpl::SignalConnected, 304 base::Bind(&PowerManagerClientImpl::SignalConnected,
293 weak_ptr_factory_.GetWeakPtr())); 305 weak_ptr_factory_.GetWeakPtr()));
294 306
295 power_manager_proxy_->ConnectToSignal( 307 power_manager_proxy_->ConnectToSignal(
296 power_manager::kPowerManagerInterface, 308 power_manager::kPowerManagerInterface,
297 power_manager::kIdleActionDeferredSignal, 309 power_manager::kIdleActionDeferredSignal,
298 base::Bind( 310 base::Bind(
299 &PowerManagerClientImpl::IdleActionDeferredReceived, 311 &PowerManagerClientImpl::IdleActionDeferredReceived,
300 weak_ptr_factory_.GetWeakPtr()), 312 weak_ptr_factory_.GetWeakPtr()),
301 base::Bind(&PowerManagerClientImpl::SignalConnected, 313 base::Bind(&PowerManagerClientImpl::SignalConnected,
302 weak_ptr_factory_.GetWeakPtr())); 314 weak_ptr_factory_.GetWeakPtr()));
303 315
304 RegisterSuspendDelay(); 316 RegisterSuspendDelays();
305 } 317 }
306 318
307 private: 319 private:
308 // Returns true if the current thread is the origin thread. 320 // Returns true if the current thread is the origin thread.
309 bool OnOriginThread() { 321 bool OnOriginThread() {
310 return base::PlatformThread::CurrentId() == origin_thread_id_; 322 return base::PlatformThread::CurrentId() == origin_thread_id_;
311 } 323 }
312 324
313 // Called when a dbus signal is initially connected. 325 // Called when a dbus signal is initially connected.
314 void SignalConnected(const std::string& interface_name, 326 void SignalConnected(const std::string& interface_name,
(...skipping 14 matching lines...) Expand all
329 } 341 }
330 342
331 void NameOwnerChangedReceived(const std::string& old_owner, 343 void NameOwnerChangedReceived(const std::string& old_owner,
332 const std::string& new_owner) { 344 const std::string& new_owner) {
333 VLOG(1) << "Power manager restarted (old owner was " 345 VLOG(1) << "Power manager restarted (old owner was "
334 << (old_owner.empty() ? "[none]" : old_owner.c_str()) 346 << (old_owner.empty() ? "[none]" : old_owner.c_str())
335 << ", new owner is " 347 << ", new owner is "
336 << (new_owner.empty() ? "[none]" : new_owner.c_str()) << ")"; 348 << (new_owner.empty() ? "[none]" : new_owner.c_str()) << ")";
337 if (!new_owner.empty()) { 349 if (!new_owner.empty()) {
338 VLOG(1) << "Sending initial state to power manager"; 350 VLOG(1) << "Sending initial state to power manager";
339 RegisterSuspendDelay(); 351 RegisterSuspendDelays();
340 SetIsProjecting(last_is_projecting_); 352 SetIsProjecting(last_is_projecting_);
341 FOR_EACH_OBSERVER(Observer, observers_, PowerManagerRestarted()); 353 FOR_EACH_OBSERVER(Observer, observers_, PowerManagerRestarted());
342 } 354 }
343 } 355 }
344 356
345 void BrightnessChangedReceived(dbus::Signal* signal) { 357 void BrightnessChangedReceived(dbus::Signal* signal) {
346 dbus::MessageReader reader(signal); 358 dbus::MessageReader reader(signal);
347 int32 brightness_level = 0; 359 int32 brightness_level = 0;
348 bool user_initiated = 0; 360 bool user_initiated = 0;
349 if (!(reader.PopInt32(&brightness_level) && 361 if (!(reader.PopInt32(&brightness_level) &&
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 return; 429 return;
418 } 430 }
419 dbus::MessageReader reader(response); 431 dbus::MessageReader reader(response);
420 double percent = 0.0; 432 double percent = 0.0;
421 if (!reader.PopDouble(&percent)) 433 if (!reader.PopDouble(&percent))
422 LOG(ERROR) << "Error reading response from powerd: " 434 LOG(ERROR) << "Error reading response from powerd: "
423 << response->ToString(); 435 << response->ToString();
424 callback.Run(percent); 436 callback.Run(percent);
425 } 437 }
426 438
427 void OnRegisterSuspendDelayReply(dbus::Response* response) { 439 void OnRegisterSuspendDelayReply(bool dark_suspend,
440 dbus::Response* response) {
428 if (!response) { 441 if (!response) {
429 LOG(ERROR) << "Error calling " 442 LOG(ERROR) << "Error calling " << response->GetMember();
430 << power_manager::kRegisterSuspendDelayMethod;
431 return; 443 return;
432 } 444 }
433 445
434 dbus::MessageReader reader(response); 446 dbus::MessageReader reader(response);
435 power_manager::RegisterSuspendDelayReply protobuf; 447 power_manager::RegisterSuspendDelayReply protobuf;
436 if (!reader.PopArrayOfBytesAsProto(&protobuf)) { 448 if (!reader.PopArrayOfBytesAsProto(&protobuf)) {
437 LOG(ERROR) << "Unable to parse reply from " 449 LOG(ERROR) << "Unable to parse reply from " << response->GetMember();
438 << power_manager::kRegisterSuspendDelayMethod;
439 return; 450 return;
440 } 451 }
441 452
442 suspend_delay_id_ = protobuf.delay_id(); 453 if (dark_suspend) {
443 has_suspend_delay_id_ = true; 454 dark_suspend_delay_id_ = protobuf.delay_id();
444 VLOG(1) << "Registered suspend delay " << suspend_delay_id_; 455 has_dark_suspend_delay_id_ = true;
456 VLOG(1) << "Registered dark suspend delay " << dark_suspend_delay_id_;
457 } else {
458 suspend_delay_id_ = protobuf.delay_id();
459 has_suspend_delay_id_ = true;
460 VLOG(1) << "Registered suspend delay " << suspend_delay_id_;
461 }
445 } 462 }
446 463
447 void SuspendImminentReceived(dbus::Signal* signal) { 464 void SuspendImminentReceived(dbus::Signal* signal) {
448 if (!has_suspend_delay_id_) { 465 SuspendImminentCommon(false, signal);
449 LOG(ERROR) << "Received unrequested " 466 }
450 << power_manager::kSuspendImminentSignal << " signal"; 467
468 void DarkSuspendImminentReceived(dbus::Signal* signal) {
Daniel Erat 2014/08/15 23:49:31 can you just eliminate these and bind true or fals
Chirantan Ekbote 2014/08/18 17:49:08 sure. will fix.
469 SuspendImminentCommon(true, signal);
470 }
471
472 void SuspendImminentCommon(bool in_dark_resume,
Daniel Erat 2014/08/15 23:49:31 nit: HandleSuspendImminent()?
473 dbus::Signal* signal) {
474 std::string signal_name = signal->GetMember();
475 if ((in_dark_resume && !has_dark_suspend_delay_id_) ||
476 (!in_dark_resume && !has_suspend_delay_id_)) {
477 LOG(ERROR) << "Received unrequested " << signal_name << " signal";
451 return; 478 return;
452 } 479 }
453 480
454 dbus::MessageReader reader(signal); 481 dbus::MessageReader reader(signal);
455 power_manager::SuspendImminent proto; 482 power_manager::SuspendImminent proto;
456 if (!reader.PopArrayOfBytesAsProto(&proto)) { 483 if (!reader.PopArrayOfBytesAsProto(&proto)) {
457 LOG(ERROR) << "Unable to decode protocol buffer from " 484 LOG(ERROR) << "Unable to decode protocol buffer from " << signal_name
458 << power_manager::kSuspendImminentSignal << " signal"; 485 << " signal";
459 return; 486 return;
460 } 487 }
461 488
462 VLOG(1) << "Got " << power_manager::kSuspendImminentSignal << " signal " 489 VLOG(1) << "Got " << signal_name << " signal announcing suspend attempt "
463 << "announcing suspend attempt " << proto.suspend_id(); 490 << proto.suspend_id();
464 if (suspend_is_pending_) { 491
465 LOG(WARNING) << "Got " << power_manager::kSuspendImminentSignal 492 // If a previous suspend is pending from the same state we are currently in
466 << " signal about pending suspend attempt " 493 // (fully powered on or in dark resume), then something's gone a little
467 << proto.suspend_id() << " while still waiting " 494 // wonky.
468 << "on attempt " << pending_suspend_id_; 495 if (suspend_is_pending_ &&
496 suspending_from_dark_resume_ == in_dark_resume) {
497 LOG(WARNING) << "Got " << signal_name << " signal about pending suspend "
498 << "attempt " << proto.suspend_id() << " while still "
499 << "waiting on attempt " << pending_suspend_id_;
Daniel Erat 2014/08/15 23:49:31 i'm trying to think of when this could happen -- w
Chirantan Ekbote 2014/08/18 17:49:08 Yes, that's the situation in which this could happ
469 } 500 }
470 501
471 pending_suspend_id_ = proto.suspend_id(); 502 pending_suspend_id_ = proto.suspend_id();
472 suspend_is_pending_ = true; 503 suspend_is_pending_ = true;
504 suspending_from_dark_resume_ = in_dark_resume;
473 num_pending_suspend_readiness_callbacks_ = 0; 505 num_pending_suspend_readiness_callbacks_ = 0;
474 FOR_EACH_OBSERVER(Observer, observers_, SuspendImminent()); 506 if (suspending_from_dark_resume_) {
Daniel Erat 2014/08/15 23:49:31 nit: omit curly brackets
507 FOR_EACH_OBSERVER(Observer, observers_, DarkSuspendImminent());
508 } else {
509 FOR_EACH_OBSERVER(Observer, observers_, SuspendImminent());
510 }
475 MaybeReportSuspendReadiness(); 511 MaybeReportSuspendReadiness();
476 } 512 }
477 513
478 void SuspendDoneReceived(dbus::Signal* signal) { 514 void SuspendDoneReceived(dbus::Signal* signal) {
479 dbus::MessageReader reader(signal); 515 dbus::MessageReader reader(signal);
480 power_manager::SuspendDone proto; 516 power_manager::SuspendDone proto;
481 if (!reader.PopArrayOfBytesAsProto(&proto)) { 517 if (!reader.PopArrayOfBytesAsProto(&proto)) {
482 LOG(ERROR) << "Unable to decode protocol buffer from " 518 LOG(ERROR) << "Unable to decode protocol buffer from "
483 << power_manager::kSuspendDoneSignal << " signal"; 519 << power_manager::kSuspendDoneSignal << " signal";
484 return; 520 return;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 case power_manager::InputEvent_Type_LID_CLOSED: { 585 case power_manager::InputEvent_Type_LID_CLOSED: {
550 bool open = 586 bool open =
551 (proto.type() == power_manager::InputEvent_Type_LID_OPEN); 587 (proto.type() == power_manager::InputEvent_Type_LID_OPEN);
552 FOR_EACH_OBSERVER(PowerManagerClient::Observer, observers_, 588 FOR_EACH_OBSERVER(PowerManagerClient::Observer, observers_,
553 LidEventReceived(open, timestamp)); 589 LidEventReceived(open, timestamp));
554 break; 590 break;
555 } 591 }
556 } 592 }
557 } 593 }
558 594
559 // Registers a suspend delay with the power manager. This is usually 595 // Registers suspend delays with the power manager. This is usually only
560 // only called at startup, but if the power manager restarts, we need to 596 // called at startup, but if the power manager restarts, we need to create new
561 // create a new delay. 597 // delays.
562 void RegisterSuspendDelay() { 598 void RegisterSuspendDelays() {
563 // Throw out any old delay that was registered. 599 // Throw out any old delay that was registered.
564 suspend_delay_id_ = -1; 600 suspend_delay_id_ = -1;
565 has_suspend_delay_id_ = false; 601 has_suspend_delay_id_ = false;
602 dark_suspend_delay_id_ = -1;
603 has_dark_suspend_delay_id_ = false;
566 604
567 dbus::MethodCall method_call( 605 dbus::MethodCall method_call(
568 power_manager::kPowerManagerInterface, 606 power_manager::kPowerManagerInterface,
569 power_manager::kRegisterSuspendDelayMethod); 607 power_manager::kRegisterSuspendDelayMethod);
570 dbus::MessageWriter writer(&method_call); 608 dbus::MessageWriter writer(&method_call);
609 dbus::MethodCall dark_method_call(
610 power_manager::kPowerManagerInterface,
611 power_manager::kRegisterDarkSuspendDelayMethod);
612 dbus::MessageWriter dark_writer(&dark_method_call);
571 613
572 power_manager::RegisterSuspendDelayRequest protobuf_request; 614 power_manager::RegisterSuspendDelayRequest protobuf_request;
573 base::TimeDelta timeout = 615 base::TimeDelta timeout =
574 base::TimeDelta::FromMilliseconds(kSuspendDelayTimeoutMs); 616 base::TimeDelta::FromMilliseconds(kSuspendDelayTimeoutMs);
575 protobuf_request.set_timeout(timeout.ToInternalValue()); 617 protobuf_request.set_timeout(timeout.ToInternalValue());
576 protobuf_request.set_description(kSuspendDelayDescription); 618 protobuf_request.set_description(kSuspendDelayDescription);
577 619
578 if (!writer.AppendProtoAsArrayOfBytes(protobuf_request)) { 620 if (!writer.AppendProtoAsArrayOfBytes(protobuf_request)) {
579 LOG(ERROR) << "Error constructing message for " 621 LOG(ERROR) << "Error constructing message for "
580 << power_manager::kRegisterSuspendDelayMethod; 622 << power_manager::kRegisterSuspendDelayMethod;
581 return; 623 return;
582 } 624 }
625 if (!dark_writer.AppendProtoAsArrayOfBytes(protobuf_request)) {
626 LOG(ERROR) << "Error constructing message for "
627 << power_manager::kRegisterDarkSuspendDelayMethod;
628 return;
629 }
583 power_manager_proxy_->CallMethod( 630 power_manager_proxy_->CallMethod(
584 &method_call, 631 &method_call,
585 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 632 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
586 base::Bind( 633 base::Bind(
587 &PowerManagerClientImpl::OnRegisterSuspendDelayReply, 634 &PowerManagerClientImpl::OnRegisterSuspendDelayReply,
588 weak_ptr_factory_.GetWeakPtr())); 635 weak_ptr_factory_.GetWeakPtr(), false));
636 power_manager_proxy_->CallMethod(
Daniel Erat 2014/08/15 23:49:31 add a helper method for this to cut down on the du
637 &dark_method_call,
638 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
639 base::Bind(
640 &PowerManagerClientImpl::OnRegisterSuspendDelayReply,
641 weak_ptr_factory_.GetWeakPtr(), true));
589 } 642 }
590 643
591 // Records the fact that an observer has finished doing asynchronous work 644 // Records the fact that an observer has finished doing asynchronous work
592 // that was blocking a pending suspend attempt and possibly reports 645 // that was blocking a pending suspend attempt and possibly reports
593 // suspend readiness to powerd. Called by callbacks returned via 646 // suspend readiness to powerd. Called by callbacks returned via
594 // GetSuspendReadinessCallback(). 647 // GetSuspendReadinessCallback().
595 void HandleObserverSuspendReadiness(int32 suspend_id) { 648 void HandleObserverSuspendReadiness(int32 suspend_id) {
596 DCHECK(OnOriginThread()); 649 DCHECK(OnOriginThread());
597 if (!suspend_is_pending_ || suspend_id != pending_suspend_id_) 650 if (!suspend_is_pending_ || suspend_id != pending_suspend_id_)
598 return; 651 return;
599 652
600 num_pending_suspend_readiness_callbacks_--; 653 num_pending_suspend_readiness_callbacks_--;
601 MaybeReportSuspendReadiness(); 654 MaybeReportSuspendReadiness();
602 } 655 }
603 656
604 // Reports suspend readiness to powerd if no observers are still holding 657 // Reports suspend readiness to powerd if no observers are still holding
605 // suspend readiness callbacks. 658 // suspend readiness callbacks.
606 void MaybeReportSuspendReadiness() { 659 void MaybeReportSuspendReadiness() {
607 if (!suspend_is_pending_ || num_pending_suspend_readiness_callbacks_ > 0) 660 if (!suspend_is_pending_ || num_pending_suspend_readiness_callbacks_ > 0)
608 return; 661 return;
609 662
663 std::string method_name;
664 int32 delay_id;
665 if (suspending_from_dark_resume_) {
666 method_name = power_manager::kHandleDarkSuspendReadinessMethod;
667 delay_id = dark_suspend_delay_id_;
668 } else {
669 method_name = power_manager::kHandleSuspendReadinessMethod;
670 delay_id = suspend_delay_id_;
671 }
672
610 dbus::MethodCall method_call( 673 dbus::MethodCall method_call(
611 power_manager::kPowerManagerInterface, 674 power_manager::kPowerManagerInterface, method_name);
612 power_manager::kHandleSuspendReadinessMethod);
613 dbus::MessageWriter writer(&method_call); 675 dbus::MessageWriter writer(&method_call);
614 676
615 VLOG(1) << "Announcing readiness of suspend delay " << suspend_delay_id_ 677 VLOG(1) << "Announcing readiness of suspend delay " << delay_id
616 << " for suspend attempt " << pending_suspend_id_; 678 << " for suspend attempt " << pending_suspend_id_;
617 power_manager::SuspendReadinessInfo protobuf_request; 679 power_manager::SuspendReadinessInfo protobuf_request;
618 protobuf_request.set_delay_id(suspend_delay_id_); 680 protobuf_request.set_delay_id(delay_id);
619 protobuf_request.set_suspend_id(pending_suspend_id_); 681 protobuf_request.set_suspend_id(pending_suspend_id_);
620 682
621 pending_suspend_id_ = -1; 683 pending_suspend_id_ = -1;
622 suspend_is_pending_ = false; 684 suspend_is_pending_ = false;
623 685
624 if (!writer.AppendProtoAsArrayOfBytes(protobuf_request)) { 686 if (!writer.AppendProtoAsArrayOfBytes(protobuf_request)) {
625 LOG(ERROR) << "Error constructing message for " 687 LOG(ERROR) << "Error constructing message for " << method_name;
626 << power_manager::kHandleSuspendReadinessMethod;
627 return; 688 return;
628 } 689 }
629 power_manager_proxy_->CallMethod( 690 power_manager_proxy_->CallMethod(
630 &method_call, 691 &method_call,
631 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 692 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
632 dbus::ObjectProxy::EmptyResponseCallback()); 693 dbus::ObjectProxy::EmptyResponseCallback());
633 } 694 }
634 695
635 // Origin thread (i.e. the UI thread in production). 696 // Origin thread (i.e. the UI thread in production).
636 base::PlatformThreadId origin_thread_id_; 697 base::PlatformThreadId origin_thread_id_;
637 698
638 dbus::ObjectProxy* power_manager_proxy_; 699 dbus::ObjectProxy* power_manager_proxy_;
639 ObserverList<Observer> observers_; 700 ObserverList<Observer> observers_;
640 701
641 // The delay_id_ obtained from the RegisterSuspendDelay request. 702 // The delay_id_ obtained from the RegisterSuspendDelay request.
642 int32 suspend_delay_id_; 703 int32 suspend_delay_id_;
643 bool has_suspend_delay_id_; 704 bool has_suspend_delay_id_;
644 705
706 // The delay_id_ obtained from the RegisterDarkSuspendDelay request.
707 int32 dark_suspend_delay_id_;
708 bool has_dark_suspend_delay_id_;
709
645 // powerd-supplied ID corresponding to an imminent suspend attempt that is 710 // powerd-supplied ID corresponding to an imminent suspend attempt that is
646 // currently being delayed. 711 // currently being delayed.
647 int32 pending_suspend_id_; 712 int32 pending_suspend_id_;
648 bool suspend_is_pending_; 713 bool suspend_is_pending_;
714 bool suspending_from_dark_resume_;
Daniel Erat 2014/08/15 23:49:31 add a comment clarifying what this means, and that
649 715
650 // Number of callbacks that have been returned by 716 // Number of callbacks that have been returned by
651 // GetSuspendReadinessCallback() during the currently-pending suspend 717 // GetSuspendReadinessCallback() during the currently-pending suspend
652 // attempt but have not yet been called. 718 // attempt but have not yet been called.
653 int num_pending_suspend_readiness_callbacks_; 719 int num_pending_suspend_readiness_callbacks_;
654 720
655 // Last state passed to SetIsProjecting(). 721 // Last state passed to SetIsProjecting().
656 bool last_is_projecting_; 722 bool last_is_projecting_;
657 723
658 // Note: This should remain the last member so it'll be destroyed and 724 // Note: This should remain the last member so it'll be destroyed and
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 // static 955 // static
890 PowerManagerClient* PowerManagerClient::Create( 956 PowerManagerClient* PowerManagerClient::Create(
891 DBusClientImplementationType type) { 957 DBusClientImplementationType type) {
892 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) 958 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION)
893 return new PowerManagerClientImpl(); 959 return new PowerManagerClientImpl();
894 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); 960 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type);
895 return new PowerManagerClientStubImpl(); 961 return new PowerManagerClientStubImpl();
896 } 962 }
897 963
898 } // namespace chromeos 964 } // namespace chromeos
OLDNEW
« chromeos/dbus/power_manager_client.h ('K') | « chromeos/dbus/power_manager_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698