| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/views/mus/window_manager_connection.h" | 5 #include "ui/views/mus/window_manager_connection.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 if (ViewsDelegate::GetInstance()) { | 52 if (ViewsDelegate::GetInstance()) { |
| 53 ViewsDelegate::GetInstance()->set_native_widget_factory( | 53 ViewsDelegate::GetInstance()->set_native_widget_factory( |
| 54 ViewsDelegate::NativeWidgetFactory()); | 54 ViewsDelegate::NativeWidgetFactory()); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 // static | 58 // static |
| 59 std::unique_ptr<WindowManagerConnection> WindowManagerConnection::Create( | 59 std::unique_ptr<WindowManagerConnection> WindowManagerConnection::Create( |
| 60 shell::Connector* connector, | 60 shell::Connector* connector, |
| 61 const shell::Identity& identity) { | 61 const shell::Identity& identity, |
| 62 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
| 62 DCHECK(!lazy_tls_ptr.Pointer()->Get()); | 63 DCHECK(!lazy_tls_ptr.Pointer()->Get()); |
| 63 WindowManagerConnection* connection = | 64 WindowManagerConnection* connection = |
| 64 new WindowManagerConnection(connector, identity); | 65 new WindowManagerConnection(connector, identity, std::move(task_runner)); |
| 65 DCHECK(lazy_tls_ptr.Pointer()->Get()); | 66 DCHECK(lazy_tls_ptr.Pointer()->Get()); |
| 66 return base::WrapUnique(connection); | 67 return base::WrapUnique(connection); |
| 67 } | 68 } |
| 68 | 69 |
| 69 // static | 70 // static |
| 70 WindowManagerConnection* WindowManagerConnection::Get() { | 71 WindowManagerConnection* WindowManagerConnection::Get() { |
| 71 WindowManagerConnection* connection = lazy_tls_ptr.Pointer()->Get(); | 72 WindowManagerConnection* connection = lazy_tls_ptr.Pointer()->Get(); |
| 72 DCHECK(connection); | 73 DCHECK(connection); |
| 73 return connection; | 74 return connection; |
| 74 } | 75 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 99 return new NativeWidgetMus(delegate, NewWindow(properties), | 100 return new NativeWidgetMus(delegate, NewWindow(properties), |
| 100 ui::mojom::SurfaceType::DEFAULT); | 101 ui::mojom::SurfaceType::DEFAULT); |
| 101 } | 102 } |
| 102 | 103 |
| 103 const std::set<ui::Window*>& WindowManagerConnection::GetRoots() const { | 104 const std::set<ui::Window*>& WindowManagerConnection::GetRoots() const { |
| 104 return client_->GetRoots(); | 105 return client_->GetRoots(); |
| 105 } | 106 } |
| 106 | 107 |
| 107 WindowManagerConnection::WindowManagerConnection( | 108 WindowManagerConnection::WindowManagerConnection( |
| 108 shell::Connector* connector, | 109 shell::Connector* connector, |
| 109 const shell::Identity& identity) | 110 const shell::Identity& identity, |
| 111 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 110 : connector_(connector), identity_(identity) { | 112 : connector_(connector), identity_(identity) { |
| 111 lazy_tls_ptr.Pointer()->Set(this); | 113 lazy_tls_ptr.Pointer()->Set(this); |
| 112 | 114 |
| 113 gpu_service_ = ui::GpuService::Initialize(connector); | 115 gpu_service_ = ui::GpuService::Create(connector, std::move(task_runner)); |
| 114 compositor_context_factory_.reset( | 116 compositor_context_factory_.reset( |
| 115 new views::SurfaceContextFactory(gpu_service_.get())); | 117 new views::SurfaceContextFactory(gpu_service_.get())); |
| 116 aura::Env::GetInstance()->set_context_factory( | 118 aura::Env::GetInstance()->set_context_factory( |
| 117 compositor_context_factory_.get()); | 119 compositor_context_factory_.get()); |
| 118 client_.reset(new ui::WindowTreeClient(this, nullptr, nullptr)); | 120 client_.reset(new ui::WindowTreeClient(this, nullptr, nullptr)); |
| 119 client_->ConnectViaWindowTreeFactory(connector_); | 121 client_->ConnectViaWindowTreeFactory(connector_); |
| 120 | 122 |
| 121 pointer_watcher_event_router_.reset( | 123 pointer_watcher_event_router_.reset( |
| 122 new PointerWatcherEventRouter(client_.get())); | 124 new PointerWatcherEventRouter(client_.get())); |
| 123 | 125 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 gfx::Point WindowManagerConnection::GetCursorScreenPoint() { | 162 gfx::Point WindowManagerConnection::GetCursorScreenPoint() { |
| 161 return client_->GetCursorScreenPoint(); | 163 return client_->GetCursorScreenPoint(); |
| 162 } | 164 } |
| 163 | 165 |
| 164 std::unique_ptr<OSExchangeData::Provider> | 166 std::unique_ptr<OSExchangeData::Provider> |
| 165 WindowManagerConnection::BuildProvider() { | 167 WindowManagerConnection::BuildProvider() { |
| 166 return base::MakeUnique<OSExchangeDataProviderMus>(); | 168 return base::MakeUnique<OSExchangeDataProviderMus>(); |
| 167 } | 169 } |
| 168 | 170 |
| 169 } // namespace views | 171 } // namespace views |
| OLD | NEW |