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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp

Issue 2846843002: [blink] Unique pointers in Platform.h (Closed)
Patch Set: fix compilation (and again) Created 3 years, 7 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 "platform/graphics/gpu/SharedContextRateLimiter.h" 5 #include "platform/graphics/gpu/SharedContextRateLimiter.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "gpu/GLES2/gl2extchromium.h" 8 #include "gpu/GLES2/gl2extchromium.h"
9 #include "platform/graphics/gpu/Extensions3DUtil.h" 9 #include "platform/graphics/gpu/Extensions3DUtil.h"
10 #include "platform/wtf/PtrUtil.h" 10 #include "platform/wtf/PtrUtil.h"
11 #include "public/platform/Platform.h" 11 #include "public/platform/Platform.h"
12 #include "public/platform/WebGraphicsContext3DProvider.h" 12 #include "public/platform/WebGraphicsContext3DProvider.h"
13 #include "third_party/khronos/GLES2/gl2.h" 13 #include "third_party/khronos/GLES2/gl2.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 std::unique_ptr<SharedContextRateLimiter> SharedContextRateLimiter::Create( 17 std::unique_ptr<SharedContextRateLimiter> SharedContextRateLimiter::Create(
18 unsigned max_pending_ticks) { 18 unsigned max_pending_ticks) {
19 return WTF::WrapUnique(new SharedContextRateLimiter(max_pending_ticks)); 19 return WTF::WrapUnique(new SharedContextRateLimiter(max_pending_ticks));
20 } 20 }
21 21
22 SharedContextRateLimiter::SharedContextRateLimiter(unsigned max_pending_ticks) 22 SharedContextRateLimiter::SharedContextRateLimiter(unsigned max_pending_ticks)
23 : max_pending_ticks_(max_pending_ticks), can_use_sync_queries_(false) { 23 : max_pending_ticks_(max_pending_ticks), can_use_sync_queries_(false) {
24 context_provider_ = WTF::WrapUnique( 24 context_provider_ =
25 Platform::Current()->CreateSharedOffscreenGraphicsContext3DProvider()); 25 Platform::Current()->CreateSharedOffscreenGraphicsContext3DProvider();
26 if (!context_provider_) 26 if (!context_provider_)
27 return; 27 return;
28 28
29 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); 29 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
30 if (gl && gl->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { 30 if (gl && gl->GetGraphicsResetStatusKHR() == GL_NO_ERROR) {
31 std::unique_ptr<Extensions3DUtil> extensions_util = 31 std::unique_ptr<Extensions3DUtil> extensions_util =
32 Extensions3DUtil::Create(gl); 32 Extensions3DUtil::Create(gl);
33 // TODO(junov): when the GLES 3.0 command buffer is ready, we could use 33 // TODO(junov): when the GLES 3.0 command buffer is ready, we could use
34 // fenceSync instead. 34 // fenceSync instead.
35 can_use_sync_queries_ = 35 can_use_sync_queries_ =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 while (queries_.size() > 0) { 74 while (queries_.size() > 0) {
75 gl->DeleteQueriesEXT(1, &queries_.front()); 75 gl->DeleteQueriesEXT(1, &queries_.front());
76 queries_.pop_front(); 76 queries_.pop_front();
77 } 77 }
78 } else { 78 } else {
79 queries_.clear(); 79 queries_.clear();
80 } 80 }
81 } 81 }
82 82
83 } // namespace blink 83 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698