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

Side by Side Diff: mandoline/ui/aura/surface_binding.cc

Issue 1311353005: Adds a way to determine id of content handler that created app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nuke comment Created 5 years, 3 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
OLDNEW
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 "mandoline/ui/aura/surface_binding.h" 5 #include "mandoline/ui/aura/surface_binding.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/threading/thread_local.h" 11 #include "base/threading/thread_local.h"
12 #include "cc/output/compositor_frame.h" 12 #include "cc/output/compositor_frame.h"
13 #include "cc/output/output_surface.h" 13 #include "cc/output/output_surface.h"
14 #include "cc/output/output_surface_client.h" 14 #include "cc/output/output_surface_client.h"
15 #include "cc/output/software_output_device.h" 15 #include "cc/output/software_output_device.h"
16 #include "cc/resources/shared_bitmap_manager.h" 16 #include "cc/resources/shared_bitmap_manager.h"
17 #include "components/view_manager/public/cpp/view.h" 17 #include "components/view_manager/public/cpp/view.h"
18 #include "components/view_manager/public/cpp/view_tree_connection.h" 18 #include "components/view_manager/public/cpp/view_tree_connection.h"
19 #include "components/view_manager/public/interfaces/gpu.mojom.h" 19 #include "components/view_manager/public/interfaces/gpu.mojom.h"
20 #include "mandoline/ui/aura/window_tree_host_mojo.h" 20 #include "mandoline/ui/aura/window_tree_host_mojo.h"
21 #include "mojo/application/public/cpp/connect.h" 21 #include "mojo/application/public/cpp/connect.h"
22 #include "mojo/application/public/interfaces/shell.mojom.h" 22 #include "mojo/application/public/interfaces/shell.mojom.h"
23 #include "mojo/cc/context_provider_mojo.h" 23 #include "mojo/cc/context_provider_mojo.h"
24 #include "mojo/cc/output_surface_mojo.h" 24 #include "mojo/cc/output_surface_mojo.h"
25 #include "mojo/converters/geometry/geometry_type_converters.h" 25 #include "mojo/converters/geometry/geometry_type_converters.h"
26 #include "mojo/converters/surfaces/surfaces_type_converters.h" 26 #include "mojo/converters/surfaces/surfaces_type_converters.h"
27 #include "mojo/public/cpp/bindings/binding.h" 27 #include "mojo/public/cpp/bindings/binding.h"
28 28
29 namespace mandoline { 29 namespace mandoline {
30 namespace {
31 void OnGotContentHandlerID(uint32_t content_handler_id) {}
32 } // namespace
30 33
31 // PerConnectionState ---------------------------------------------------------- 34 // PerConnectionState ----------------------------------------------------------
32 35
33 // State needed per ViewManager. Provides the real implementation of 36 // State needed per ViewManager. Provides the real implementation of
34 // CreateOutputSurface. SurfaceBinding obtains a pointer to the 37 // CreateOutputSurface. SurfaceBinding obtains a pointer to the
35 // PerConnectionState appropriate for the ViewManager. PerConnectionState is 38 // PerConnectionState appropriate for the ViewManager. PerConnectionState is
36 // stored in a thread local map. When no more refereces to a PerConnectionState 39 // stored in a thread local map. When no more refereces to a PerConnectionState
37 // remain the PerConnectionState is deleted and the underlying map cleaned up. 40 // remain the PerConnectionState is deleted and the underlying map cleaned up.
38 class SurfaceBinding::PerConnectionState 41 class SurfaceBinding::PerConnectionState
39 : public base::RefCounted<PerConnectionState> { 42 : public base::RefCounted<PerConnectionState> {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (view_map->empty()) { 117 if (view_map->empty()) {
115 delete view_map; 118 delete view_map;
116 view_states.Pointer()->Set(nullptr); 119 view_states.Pointer()->Set(nullptr);
117 } 120 }
118 } 121 }
119 122
120 void SurfaceBinding::PerConnectionState::Init() { 123 void SurfaceBinding::PerConnectionState::Init() {
121 mojo::ServiceProviderPtr service_provider; 124 mojo::ServiceProviderPtr service_provider;
122 mojo::URLRequestPtr request(mojo::URLRequest::New()); 125 mojo::URLRequestPtr request(mojo::URLRequest::New());
123 request->url = mojo::String::From("mojo:view_manager"); 126 request->url = mojo::String::From("mojo:view_manager");
124 shell_->ConnectToApplication(request.Pass(), 127 shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider),
125 GetProxy(&service_provider), 128 nullptr, nullptr,
126 nullptr, 129 base::Bind(&OnGotContentHandlerID));
127 nullptr);
128 ConnectToService(service_provider.get(), &gpu_); 130 ConnectToService(service_provider.get(), &gpu_);
129 } 131 }
130 132
131 // SurfaceBinding -------------------------------------------------------------- 133 // SurfaceBinding --------------------------------------------------------------
132 134
133 SurfaceBinding::SurfaceBinding(mojo::Shell* shell, mojo::View* view) 135 SurfaceBinding::SurfaceBinding(mojo::Shell* shell, mojo::View* view)
134 : view_(view), 136 : view_(view),
135 state_(PerConnectionState::Get(shell, view->connection())) { 137 state_(PerConnectionState::Get(shell, view->connection())) {
136 } 138 }
137 139
138 SurfaceBinding::~SurfaceBinding() { 140 SurfaceBinding::~SurfaceBinding() {
139 } 141 }
140 142
141 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { 143 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() {
142 return state_->CreateOutputSurface(view_); 144 return state_->CreateOutputSurface(view_);
143 } 145 }
144 146
145 } // namespace mandoline 147 } // namespace mandoline
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | mojo/application/public/cpp/application_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698