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

Side by Side Diff: components/mus/public/cpp/lib/context_provider.cc

Issue 1976703003: Impl mus::mojom::GpuService to enable using Chrome IPC version gpu CmdBuf in mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 6 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 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 "components/mus/public/cpp/context_provider.h" 5 #include "components/mus/public/cpp/context_provider.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "components/mus/public/cpp/gles2_context.h" 10 #include "components/mus/public/cpp/gles2_context.h"
11 11
12 namespace mus { 12 namespace mus {
13 13
14 ContextProvider::ContextProvider( 14 ContextProvider::ContextProvider(shell::Connector* connector)
15 mojo::ScopedMessagePipeHandle command_buffer_handle) 15 : connector_(connector) {}
16 : command_buffer_handle_(std::move(command_buffer_handle)),
17 context_(nullptr) {
18 }
19 16
20 bool ContextProvider::BindToCurrentThread() { 17 bool ContextProvider::BindToCurrentThread() {
21 mojom::CommandBufferPtr command_buffer_ptr; 18 context_ =
22 command_buffer_ptr.Bind(mojo::InterfacePtrInfo<mus::mojom::CommandBuffer>( 19 GLES2Context::CreateOffscreenContext(std::vector<int32_t>(), connector_);
sadrul 2016/06/01 19:16:57 Note that if |connector_| is coming from a differe
Peng 2016/06/01 20:00:42 Good catch. Done.
23 std::move(command_buffer_handle_), 0u));
24 std::unique_ptr<GLES2Context> context(
25 new GLES2Context(std::vector<int32_t>(), std::move(command_buffer_ptr)));
26 if (context->Initialize())
27 context_ = std::move(context);
28 return !!context_; 20 return !!context_;
29 } 21 }
30 22
31 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { 23 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() {
32 return context_->interface(); 24 return context_->interface();
33 } 25 }
34 26
35 gpu::ContextSupport* ContextProvider::ContextSupport() { 27 gpu::ContextSupport* ContextProvider::ContextSupport() {
36 if (!context_) 28 if (!context_)
37 return NULL; 29 return NULL;
(...skipping 17 matching lines...) Expand all
55 base::Lock* ContextProvider::GetLock() { 47 base::Lock* ContextProvider::GetLock() {
56 // This context provider is not used on multiple threads. 48 // This context provider is not used on multiple threads.
57 NOTREACHED(); 49 NOTREACHED();
58 return nullptr; 50 return nullptr;
59 } 51 }
60 52
61 ContextProvider::~ContextProvider() { 53 ContextProvider::~ContextProvider() {
62 } 54 }
63 55
64 } // namespace mus 56 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/public/cpp/gles2_context.h ('k') | components/mus/public/cpp/lib/gles2_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698