| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/window_tree_host.h" | 5 #include "ui/aura/window_tree_host.h" |
| 6 | 6 |
| 7 #include "base/threading/thread_task_runner_handle.h" | 7 #include "base/threading/thread_task_runner_handle.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "ui/aura/client/capture_client.h" | 9 #include "ui/aura/client/capture_client.h" |
| 10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // we ensure GetRootWindow() still returns this. | 242 // we ensure GetRootWindow() still returns this. |
| 243 //window()->RemoveOrDestroyChildren(); | 243 //window()->RemoveOrDestroyChildren(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void WindowTreeHost::CreateCompositor(const cc::FrameSinkId& frame_sink_id) { | 246 void WindowTreeHost::CreateCompositor(const cc::FrameSinkId& frame_sink_id) { |
| 247 DCHECK(Env::GetInstance()); | 247 DCHECK(Env::GetInstance()); |
| 248 ui::ContextFactory* context_factory = Env::GetInstance()->context_factory(); | 248 ui::ContextFactory* context_factory = Env::GetInstance()->context_factory(); |
| 249 DCHECK(context_factory); | 249 DCHECK(context_factory); |
| 250 ui::ContextFactoryPrivate* context_factory_private = | 250 ui::ContextFactoryPrivate* context_factory_private = |
| 251 Env::GetInstance()->context_factory_private(); | 251 Env::GetInstance()->context_factory_private(); |
| 252 compositor_.reset(new ui::Compositor( | 252 compositor_.reset( |
| 253 frame_sink_id.is_valid() ? frame_sink_id | 253 new ui::Compositor((!context_factory_private || frame_sink_id.is_valid()) |
| 254 : context_factory_private->AllocateFrameSinkId(), | 254 ? frame_sink_id |
| 255 context_factory, context_factory_private, | 255 : context_factory_private->AllocateFrameSinkId(), |
| 256 base::ThreadTaskRunnerHandle::Get())); | 256 context_factory, context_factory_private, |
| 257 base::ThreadTaskRunnerHandle::Get())); |
| 257 if (!dispatcher()) { | 258 if (!dispatcher()) { |
| 258 window()->Init(ui::LAYER_NOT_DRAWN); | 259 window()->Init(ui::LAYER_NOT_DRAWN); |
| 259 window()->set_host(this); | 260 window()->set_host(this); |
| 260 window()->SetName("RootWindow"); | 261 window()->SetName("RootWindow"); |
| 261 dispatcher_.reset(new WindowEventDispatcher(this)); | 262 dispatcher_.reset(new WindowEventDispatcher(this)); |
| 262 } | 263 } |
| 263 } | 264 } |
| 264 | 265 |
| 265 void WindowTreeHost::InitCompositor() { | 266 void WindowTreeHost::InitCompositor() { |
| 266 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), | 267 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 client::CursorClient* cursor_client = client::GetCursorClient(window()); | 343 client::CursorClient* cursor_client = client::GetCursorClient(window()); |
| 343 if (cursor_client) { | 344 if (cursor_client) { |
| 344 const display::Display& display = | 345 const display::Display& display = |
| 345 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); | 346 display::Screen::GetScreen()->GetDisplayNearestWindow(window()); |
| 346 cursor_client->SetDisplay(display); | 347 cursor_client->SetDisplay(display); |
| 347 } | 348 } |
| 348 dispatcher()->OnCursorMovedToRootLocation(root_location); | 349 dispatcher()->OnCursorMovedToRootLocation(root_location); |
| 349 } | 350 } |
| 350 | 351 |
| 351 } // namespace aura | 352 } // namespace aura |
| OLD | NEW |