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

Side by Side Diff: services/ui/public/cpp/context_provider.cc

Issue 2233003003: services/ui: Inject GpuService instance where needed, instead of singleton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 | « services/ui/public/cpp/context_provider.h ('k') | services/ui/public/cpp/gles2_context.h » ('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/public/cpp/context_provider.h" 5 #include "services/ui/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 "services/ui/public/cpp/gles2_context.h" 10 #include "services/ui/public/cpp/gles2_context.h"
11 11
12 namespace ui { 12 namespace ui {
13 13
14 ContextProvider::ContextProvider() {} 14 ContextProvider::ContextProvider(GpuService* gpu_service)
15 : gpu_service_(gpu_service) {}
15 16
16 bool ContextProvider::BindToCurrentThread() { 17 bool ContextProvider::BindToCurrentThread() {
17 context_ = GLES2Context::CreateOffscreenContext(std::vector<int32_t>()); 18 context_ = GLES2Context::CreateOffscreenContext(gpu_service_);
18 return !!context_; 19 return !!context_;
19 } 20 }
20 21
21 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() { 22 gpu::gles2::GLES2Interface* ContextProvider::ContextGL() {
22 return context_->interface(); 23 return context_->interface();
23 } 24 }
24 25
25 gpu::ContextSupport* ContextProvider::ContextSupport() { 26 gpu::ContextSupport* ContextProvider::ContextSupport() {
26 if (!context_) 27 if (!context_)
27 return NULL; 28 return NULL;
(...skipping 17 matching lines...) Expand all
45 base::Lock* ContextProvider::GetLock() { 46 base::Lock* ContextProvider::GetLock() {
46 // This context provider is not used on multiple threads. 47 // This context provider is not used on multiple threads.
47 NOTREACHED(); 48 NOTREACHED();
48 return nullptr; 49 return nullptr;
49 } 50 }
50 51
51 ContextProvider::~ContextProvider() { 52 ContextProvider::~ContextProvider() {
52 } 53 }
53 54
54 } // namespace ui 55 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/cpp/context_provider.h ('k') | services/ui/public/cpp/gles2_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698