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

Side by Side Diff: content/browser/compositor/mus_browser_compositor_output_surface.cc

Issue 2188813003: content: Remove views dependency. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus-public-cpp-component
Patch Set: . Created 4 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
« no previous file with comments | « content/browser/compositor/DEPS ('k') | services/ui/public/cpp/lib/window.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/browser/compositor/mus_browser_compositor_output_surface.h" 5 #include "content/browser/compositor/mus_browser_compositor_output_surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/quads/render_pass.h" 10 #include "cc/quads/render_pass.h"
11 #include "cc/quads/texture_draw_quad.h" 11 #include "cc/quads/texture_draw_quad.h"
12 #include "components/display_compositor/compositor_overlay_candidate_validator.h " 12 #include "components/display_compositor/compositor_overlay_candidate_validator.h "
13 #include "content/common/gpu/client/context_provider_command_buffer.h" 13 #include "content/common/gpu/client/context_provider_command_buffer.h"
14 #include "gpu/command_buffer/client/gles2_interface.h" 14 #include "gpu/command_buffer/client/gles2_interface.h"
15 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 15 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
16 #include "services/ui/public/cpp/window.h" 16 #include "services/ui/public/cpp/window.h"
17 #include "services/ui/public/cpp/window_surface.h" 17 #include "services/ui/public/cpp/window_surface.h"
18 #include "ui/views/mus/native_widget_mus.h" 18 #include "ui/base/view_prop.h"
19 #include "ui/views/mus/window_tree_host_mus.h"
20 19
21 namespace content { 20 namespace content {
22 21
23 MusBrowserCompositorOutputSurface::MusBrowserCompositorOutputSurface( 22 MusBrowserCompositorOutputSurface::MusBrowserCompositorOutputSurface(
24 gpu::SurfaceHandle surface_handle, 23 gpu::SurfaceHandle surface_handle,
25 scoped_refptr<ContextProviderCommandBuffer> context, 24 scoped_refptr<ContextProviderCommandBuffer> context,
26 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, 25 scoped_refptr<ui::CompositorVSyncManager> vsync_manager,
27 cc::SyntheticBeginFrameSource* begin_frame_source, 26 cc::SyntheticBeginFrameSource* begin_frame_source,
28 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> 27 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator>
29 overlay_candidate_validator) 28 overlay_candidate_validator)
30 : GpuBrowserCompositorOutputSurface(std::move(context), 29 : GpuBrowserCompositorOutputSurface(std::move(context),
31 std::move(vsync_manager), 30 std::move(vsync_manager),
32 begin_frame_source, 31 begin_frame_source,
33 std::move(overlay_candidate_validator)), 32 std::move(overlay_candidate_validator)),
34 ui_window_(nullptr) { 33 ui_window_(nullptr) {
35 views::WindowTreeHostMus* window_tree_host = 34 ui_window_ = reinterpret_cast<ui::Window*>(
36 static_cast<views::WindowTreeHostMus*>( 35 ui::ViewProp::GetValue(surface_handle, ui::kWindowForAcceleratedWidget));
37 aura::WindowTreeHost::GetForAcceleratedWidget(surface_handle));
38 ui_window_ = window_tree_host->native_widget()->window();
39 ui_window_surface_ = 36 ui_window_surface_ =
40 ui_window_->RequestSurface(ui::mojom::SurfaceType::DEFAULT); 37 ui_window_->RequestSurface(ui::mojom::SurfaceType::DEFAULT);
41 } 38 }
42 39
43 MusBrowserCompositorOutputSurface::~MusBrowserCompositorOutputSurface() {} 40 MusBrowserCompositorOutputSurface::~MusBrowserCompositorOutputSurface() {}
44 41
45 void MusBrowserCompositorOutputSurface::SwapBuffers(cc::CompositorFrame frame) { 42 void MusBrowserCompositorOutputSurface::SwapBuffers(cc::CompositorFrame frame) {
46 const gfx::Rect bounds(ui_window_->bounds().size()); 43 const gfx::Rect bounds(ui_window_->bounds().size());
47 cc::CompositorFrame ui_frame; 44 cc::CompositorFrame ui_frame;
48 ui_frame.metadata = std::move(frame.metadata); 45 ui_frame.metadata = std::move(frame.metadata);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 159
163 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId( 160 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId(
164 uint32_t id) { 161 uint32_t id) {
165 DCHECK_LT(id, mailboxes_.size()); 162 DCHECK_LT(id, mailboxes_.size());
166 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) == 163 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) ==
167 free_resource_ids_.end()); 164 free_resource_ids_.end());
168 return mailboxes_[id]; 165 return mailboxes_[id];
169 } 166 }
170 167
171 } // namespace content 168 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/DEPS ('k') | services/ui/public/cpp/lib/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698