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

Unified Diff: gpu/command_buffer/service/gpu_tracer.cc

Issue 130313002: Make correct GL context current during gpu_tracer processing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed lint errors. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gpu_tracer.cc
diff --git a/gpu/command_buffer/service/gpu_tracer.cc b/gpu/command_buffer/service/gpu_tracer.cc
index c9bb50938ba499ef99511929af1c4f92af7346d9..dbd3980942d53606ab073cce1b7ed7fefbc0bbe6 100644
--- a/gpu/command_buffer/service/gpu_tracer.cc
+++ b/gpu/command_buffer/service/gpu_tracer.cc
@@ -69,11 +69,11 @@ class GPUTracerImpl
: public GPUTracer,
public base::SupportsWeakPtr<GPUTracerImpl> {
public:
- GPUTracerImpl()
- : gpu_category_enabled_(
- TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED("gpu")),
- process_posted_(false) {
- }
+ explicit GPUTracerImpl(base::WeakPtr<gles2::GLES2Decoder> decoder)
+ : GPUTracer(decoder),
+ gpu_category_enabled_(
+ TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED("gpu")),
+ process_posted_(false) {}
virtual ~GPUTracerImpl() {}
// Implementation of gpu::gles2::GPUTracer
@@ -103,7 +103,7 @@ class GPUTracerImpl
class GPUTracerARBTimerQuery : public GPUTracerImpl {
public:
- GPUTracerARBTimerQuery();
+ explicit GPUTracerARBTimerQuery(base::WeakPtr<gles2::GLES2Decoder> decoder);
virtual ~GPUTracerARBTimerQuery();
// Implementation of GPUTracerImpl
@@ -204,6 +204,9 @@ bool GPUTracerImpl::End() {
void GPUTracerImpl::Process() {
process_posted_ = false;
+ // Make owning decoder's GL context current
+ decoder_->MakeCurrent();
piman 2014/01/09 02:10:33 note: MakeCurrent can fail (e.g. lost context). In
vmiura 2014/01/09 02:57:02 Done. In this case I will skip all GL calls, incl
+
while (!traces_.empty() && traces_.front()->IsAvailable()) {
traces_.front()->Process();
traces_.pop_front();
@@ -233,10 +236,9 @@ void GPUTracerImpl::IssueProcessTask() {
base::TimeDelta::FromMilliseconds(kProcessInterval));
}
-GPUTracerARBTimerQuery::GPUTracerARBTimerQuery()
- : GPUTracerImpl(),
- timer_offset_(0),
- last_offset_check_(0) {
+GPUTracerARBTimerQuery::GPUTracerARBTimerQuery(
+ base::WeakPtr<gles2::GLES2Decoder> decoder)
+ : GPUTracerImpl(decoder), timer_offset_(0), last_offset_check_(0) {
CalculateTimerOffset();
outputter_ = TraceOutputter::Create("GL_ARB_timer_query");
}
@@ -278,11 +280,17 @@ void GPUTracerARBTimerQuery::CalculateTimerOffset() {
last_offset_check_ = system_now.ToInternalValue();
}
-scoped_ptr<GPUTracer> GPUTracer::Create() {
+GPUTracer::GPUTracer(base::WeakPtr<gles2::GLES2Decoder> decoder)
+ : decoder_(decoder) {}
+
+GPUTracer::~GPUTracer() {}
+
+scoped_ptr<GPUTracer> GPUTracer::Create(
+ base::WeakPtr<gles2::GLES2Decoder> decoder) {
if (gfx::g_driver_gl.ext.b_GL_ARB_timer_query) {
- return scoped_ptr<GPUTracer>(new GPUTracerARBTimerQuery());
+ return scoped_ptr<GPUTracer>(new GPUTracerARBTimerQuery(decoder));
}
- return scoped_ptr<GPUTracer>(new GPUTracerImpl());
+ return scoped_ptr<GPUTracer>(new GPUTracerImpl(decoder));
}
} // namespace gles2
« gpu/command_buffer/service/gles2_cmd_decoder.cc ('K') | « gpu/command_buffer/service/gpu_tracer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698