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

Side by Side Diff: content/browser/gpu/shader_cache_factory.cc

Issue 2565223003: content: Move shader cache factory singleton into a separate file. (Closed)
Patch Set: Created 4 years 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/gpu/shader_cache_factory.h ('k') | content/browser/gpu/shader_disk_cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/gpu/shader_cache_factory.h"
6
7 #include "base/single_thread_task_runner.h"
8 #include "content/browser/gpu/shader_disk_cache.h"
9
10 namespace content {
11
12 namespace {
13
14 ShaderCacheFactory* factory_instance = nullptr;
15
16 void CreateFactoryInstance(
17 scoped_refptr<base::SingleThreadTaskRunner> cache_task_runner) {
18 DCHECK(!factory_instance);
19 factory_instance = new ShaderCacheFactory(std::move(cache_task_runner));
20 }
21
22 } // namespace
23
24 void InitShaderCacheFactorySingleton(
25 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
26 scoped_refptr<base::SingleThreadTaskRunner> cache_task_runner) {
27 if (task_runner->BelongsToCurrentThread()) {
28 CreateFactoryInstance(std::move(cache_task_runner));
29 } else {
30 task_runner->PostTask(FROM_HERE, base::Bind(&CreateFactoryInstance,
31 std::move(cache_task_runner)));
32 }
33 }
34
35 ShaderCacheFactory* GetShaderCacheFactorySingleton() {
36 DCHECK(!factory_instance || factory_instance->CalledOnValidThread());
37 return factory_instance;
38 }
39
40 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/shader_cache_factory.h ('k') | content/browser/gpu/shader_disk_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698