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

Side by Side Diff: services/ui/ws/window_tree.cc

Issue 2429173005: Mus+Ash: Replace (Server)WindowSurface with (Server)WindowCompositorFrameSink (Closed)
Patch Set: Rebased Created 4 years, 2 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
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | services/ui/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "services/ui/ws/window_tree.h" 5 #include "services/ui/ws/window_tree.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "services/ui/ws/default_access_policy.h" 14 #include "services/ui/ws/default_access_policy.h"
15 #include "services/ui/ws/display.h" 15 #include "services/ui/ws/display.h"
16 #include "services/ui/ws/display_manager.h" 16 #include "services/ui/ws/display_manager.h"
17 #include "services/ui/ws/event_matcher.h" 17 #include "services/ui/ws/event_matcher.h"
18 #include "services/ui/ws/focus_controller.h" 18 #include "services/ui/ws/focus_controller.h"
19 #include "services/ui/ws/operation.h" 19 #include "services/ui/ws/operation.h"
20 #include "services/ui/ws/platform_display.h" 20 #include "services/ui/ws/platform_display.h"
21 #include "services/ui/ws/server_window.h" 21 #include "services/ui/ws/server_window.h"
22 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h"
22 #include "services/ui/ws/server_window_observer.h" 23 #include "services/ui/ws/server_window_observer.h"
23 #include "services/ui/ws/server_window_surface_manager.h"
24 #include "services/ui/ws/user_display_manager.h" 24 #include "services/ui/ws/user_display_manager.h"
25 #include "services/ui/ws/window_manager_display_root.h" 25 #include "services/ui/ws/window_manager_display_root.h"
26 #include "services/ui/ws/window_manager_state.h" 26 #include "services/ui/ws/window_manager_state.h"
27 #include "services/ui/ws/window_server.h" 27 #include "services/ui/ws/window_server.h"
28 #include "services/ui/ws/window_tree_binding.h" 28 #include "services/ui/ws/window_tree_binding.h"
29 #include "ui/display/display.h" 29 #include "ui/display/display.h"
30 #include "ui/platform_window/mojo/ime_type_converters.h" 30 #include "ui/platform_window/mojo/ime_type_converters.h"
31 #include "ui/platform_window/text_input_state.h" 31 #include "ui/platform_window/text_input_state.h"
32 32
33 using mojo::Array; 33 using mojo::Array;
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 const gfx::Size& frame_size, 766 const gfx::Size& frame_size,
767 float device_scale_factor) { 767 float device_scale_factor) {
768 ServerWindow* parent_window = window->parent(); 768 ServerWindow* parent_window = window->parent();
769 ClientWindowId client_window_id, parent_client_window_id; 769 ClientWindowId client_window_id, parent_client_window_id;
770 if (!IsWindowKnown(window, &client_window_id) || 770 if (!IsWindowKnown(window, &client_window_id) ||
771 !IsWindowKnown(parent_window, &parent_client_window_id) || 771 !IsWindowKnown(parent_window, &parent_client_window_id) ||
772 !created_window_map_.count(parent_window->id())) { 772 !created_window_map_.count(parent_window->id())) {
773 return; 773 return;
774 } 774 }
775 775
776 ServerWindowSurfaceManager* surface_manager = 776 ServerWindowCompositorFrameSinkManager* compositor_frame_sink_manager =
777 window->GetOrCreateSurfaceManager(); 777 window->GetOrCreateCompositorFrameSinkManager();
778 ServerWindowSurface* surface = surface_manager->GetDefaultSurface(); 778 ServerWindowCompositorFrameSink* compositor_frame_sink =
779 cc::SurfaceSequence sequence = surface->CreateSurfaceSequence(); 779 compositor_frame_sink_manager->GetDefaultCompositorFrameSink();
780 cc::SurfaceSequence sequence = compositor_frame_sink->CreateSurfaceSequence();
780 client()->OnWindowSurfaceChanged(client_window_id.id, surface_id, sequence, 781 client()->OnWindowSurfaceChanged(client_window_id.id, surface_id, sequence,
781 frame_size, device_scale_factor); 782 frame_size, device_scale_factor);
782 } 783 }
783 784
784 void WindowTree::SendToPointerWatcher(const ui::Event& event, 785 void WindowTree::SendToPointerWatcher(const ui::Event& event,
785 ServerWindow* target_window) { 786 ServerWindow* target_window) {
786 if (!EventMatchesPointerWatcher(event)) 787 if (!EventMatchesPointerWatcher(event))
787 return; 788 return;
788 789
789 ClientWindowId client_window_id; 790 ClientWindowId client_window_id;
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 client()->OnChangeCompleted(change_id, success); 1343 client()->OnChangeCompleted(change_id, success);
1343 } 1344 }
1344 1345
1345 void WindowTree::SetWindowOpacity(uint32_t change_id, 1346 void WindowTree::SetWindowOpacity(uint32_t change_id,
1346 Id window_id, 1347 Id window_id,
1347 float opacity) { 1348 float opacity) {
1348 client()->OnChangeCompleted( 1349 client()->OnChangeCompleted(
1349 change_id, SetWindowOpacity(ClientWindowId(window_id), opacity)); 1350 change_id, SetWindowOpacity(ClientWindowId(window_id), opacity));
1350 } 1351 }
1351 1352
1352 void WindowTree::AttachSurface( 1353 void WindowTree::AttachCompositorFrameSink(
1353 Id transport_window_id, 1354 Id transport_window_id,
1354 mojom::SurfaceType type, 1355 mojom::CompositorFrameSinkType type,
1355 mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSink> surface, 1356 mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSink> surface,
1356 cc::mojom::MojoCompositorFrameSinkClientPtr client) { 1357 cc::mojom::MojoCompositorFrameSinkClientPtr client) {
1357 ServerWindow* window = 1358 ServerWindow* window =
1358 GetWindowByClientId(ClientWindowId(transport_window_id)); 1359 GetWindowByClientId(ClientWindowId(transport_window_id));
1359 const bool success = 1360 const bool success =
1360 window && access_policy_->CanSetWindowSurface(window, type); 1361 window && access_policy_->CanSetWindowCompositorFrameSink(window, type);
1361 if (!success) { 1362 if (!success) {
1362 DVLOG(1) << "request to AttachSurface failed"; 1363 DVLOG(1) << "request to AttachCompositorFrameSink failed";
1363 return; 1364 return;
1364 } 1365 }
1365 window->CreateSurface(type, std::move(surface), std::move(client)); 1366 window->CreateCompositorFrameSink(type, std::move(surface),
1367 std::move(client));
1366 } 1368 }
1367 1369
1368 void WindowTree::OnWindowSurfaceDetached(Id transport_window_id, 1370 void WindowTree::OnWindowSurfaceDetached(Id transport_window_id,
1369 const cc::SurfaceSequence& sequence) { 1371 const cc::SurfaceSequence& sequence) {
1370 ServerWindow* window = 1372 ServerWindow* window =
1371 GetWindowByClientId(ClientWindowId(transport_window_id)); 1373 GetWindowByClientId(ClientWindowId(transport_window_id));
1372 if (!window) 1374 if (!window)
1373 return; 1375 return;
1374 window_server_->GetDisplayCompositor()->ReturnSurfaceReference(sequence); 1376 window_server_->GetDisplayCompositor()->ReturnSurfaceReference(sequence);
1375 } 1377 }
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, 1943 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset,
1942 effect_bitmask, callback); 1944 effect_bitmask, callback);
1943 } 1945 }
1944 1946
1945 void WindowTree::PerformOnDragDropDone() { 1947 void WindowTree::PerformOnDragDropDone() {
1946 client()->OnDragDropDone(); 1948 client()->OnDragDropDone();
1947 } 1949 }
1948 1950
1949 } // namespace ws 1951 } // namespace ws
1950 } // namespace ui 1952 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | services/ui/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698