| 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 "ui/aura/mus/window_tree_client.h" | 5 #include "ui/aura/mus/window_tree_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/auto_reset.h" | 13 #include "base/auto_reset.h" |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/message_loop/message_loop.h" |
| 18 #include "base/run_loop.h" |
| 17 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 18 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
| 19 #include "components/discardable_memory/client/client_discardable_shared_memory_
manager.h" | 21 #include "components/discardable_memory/client/client_discardable_shared_memory_
manager.h" |
| 20 #include "mojo/public/cpp/bindings/map.h" | 22 #include "mojo/public/cpp/bindings/map.h" |
| 21 #include "services/service_manager/public/cpp/connector.h" | 23 #include "services/service_manager/public/cpp/connector.h" |
| 22 #include "services/ui/common/accelerator_util.h" | 24 #include "services/ui/common/accelerator_util.h" |
| 23 #include "services/ui/public/cpp/gpu/gpu.h" | 25 #include "services/ui/public/cpp/gpu/gpu.h" |
| 24 #include "services/ui/public/cpp/property_type_converters.h" | 26 #include "services/ui/public/cpp/property_type_converters.h" |
| 25 #include "services/ui/public/interfaces/constants.mojom.h" | 27 #include "services/ui/public/interfaces/constants.mojom.h" |
| 26 #include "services/ui/public/interfaces/window_manager.mojom.h" | 28 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 return static_cast<uint16_t>((id >> 16) & 0xFFFF); | 75 return static_cast<uint16_t>((id >> 16) & 0xFFFF); |
| 74 } | 76 } |
| 75 | 77 |
| 76 struct WindowPortPropertyDataMus : public ui::PropertyData { | 78 struct WindowPortPropertyDataMus : public ui::PropertyData { |
| 77 std::string transport_name; | 79 std::string transport_name; |
| 78 std::unique_ptr<std::vector<uint8_t>> transport_value; | 80 std::unique_ptr<std::vector<uint8_t>> transport_value; |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 // Handles acknowledgment of an input event, either immediately when a nested | 83 // Handles acknowledgment of an input event, either immediately when a nested |
| 82 // message loop starts, or upon destruction. | 84 // message loop starts, or upon destruction. |
| 83 class EventAckHandler : public base::MessageLoop::NestingObserver { | 85 class EventAckHandler : public base::RunLoop::NestingObserver { |
| 84 public: | 86 public: |
| 85 explicit EventAckHandler(std::unique_ptr<EventResultCallback> ack_callback) | 87 explicit EventAckHandler(std::unique_ptr<EventResultCallback> ack_callback) |
| 86 : ack_callback_(std::move(ack_callback)) { | 88 : ack_callback_(std::move(ack_callback)) { |
| 87 DCHECK(ack_callback_); | 89 DCHECK(ack_callback_); |
| 88 base::MessageLoop::current()->AddNestingObserver(this); | 90 base::RunLoop::AddNestingObserverOnCurrentThread(this); |
| 89 } | 91 } |
| 90 | 92 |
| 91 ~EventAckHandler() override { | 93 ~EventAckHandler() override { |
| 92 base::MessageLoop::current()->RemoveNestingObserver(this); | 94 base::RunLoop::RemoveNestingObserverOnCurrentThread(this); |
| 93 if (ack_callback_) { | 95 if (ack_callback_) { |
| 94 ack_callback_->Run(handled_ ? ui::mojom::EventResult::HANDLED | 96 ack_callback_->Run(handled_ ? ui::mojom::EventResult::HANDLED |
| 95 : ui::mojom::EventResult::UNHANDLED); | 97 : ui::mojom::EventResult::UNHANDLED); |
| 96 } | 98 } |
| 97 } | 99 } |
| 98 | 100 |
| 99 void set_handled(bool handled) { handled_ = handled; } | 101 void set_handled(bool handled) { handled_ = handled; } |
| 100 | 102 |
| 101 // base::MessageLoop::NestingObserver: | 103 // base::RunLoop::NestingObserver: |
| 102 void OnBeginNestedMessageLoop() override { | 104 void OnBeginNestedMessageLoop() override { |
| 103 // Acknowledge the event immediately if a nested message loop starts. | 105 // Acknowledge the event immediately if a nested message loop starts. |
| 104 // Otherwise we appear unresponsive for the life of the nested message loop. | 106 // Otherwise we appear unresponsive for the life of the nested message loop. |
| 105 if (ack_callback_) { | 107 if (ack_callback_) { |
| 106 ack_callback_->Run(ui::mojom::EventResult::HANDLED); | 108 ack_callback_->Run(ui::mojom::EventResult::HANDLED); |
| 107 ack_callback_.reset(); | 109 ack_callback_.reset(); |
| 108 } | 110 } |
| 109 } | 111 } |
| 110 | 112 |
| 111 private: | 113 private: |
| (...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1967 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
| 1966 this, capture_synchronizer_.get(), window)); | 1968 this, capture_synchronizer_.get(), window)); |
| 1967 } | 1969 } |
| 1968 | 1970 |
| 1969 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1971 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
| 1970 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1972 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
| 1971 this, focus_synchronizer_.get(), window)); | 1973 this, focus_synchronizer_.get(), window)); |
| 1972 } | 1974 } |
| 1973 | 1975 |
| 1974 } // namespace aura | 1976 } // namespace aura |
| OLD | NEW |