OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 !surface_id(), | 500 !surface_id(), |
501 initial_size_, | 501 initial_size_, |
502 disallowed_features_, | 502 disallowed_features_, |
503 allowed_extensions_.c_str(), | 503 allowed_extensions_.c_str(), |
504 requested_attribs_)) { | 504 requested_attribs_)) { |
505 DLOG(ERROR) << "Failed to initialize decoder."; | 505 DLOG(ERROR) << "Failed to initialize decoder."; |
506 OnInitializeFailed(reply_message); | 506 OnInitializeFailed(reply_message); |
507 return; | 507 return; |
508 } | 508 } |
509 | 509 |
| 510 // TODO(epenner): If we can initialize the feature-info earlier, |
| 511 // this code can be removed and done only during surface creation. |
| 512 // This code is only needed for the very first surface, which is |
| 513 // created before the ContextGroup is initialized. |
| 514 if (context_group_->feature_info()->workarounds() |
| 515 .makecurrent_recreates_surfaces) { |
| 516 // This only works with virtual contexts! |
| 517 DCHECK(CommandLine::ForCurrentProcess()->HasSwitch( |
| 518 switches::kEnableVirtualGLContexts)); |
| 519 surface_->SetRecreateOnMakeCurrent(true); |
| 520 } |
| 521 |
510 if (CommandLine::ForCurrentProcess()->HasSwitch( | 522 if (CommandLine::ForCurrentProcess()->HasSwitch( |
511 switches::kEnableGPUServiceLogging)) { | 523 switches::kEnableGPUServiceLogging)) { |
512 decoder_->set_log_commands(true); | 524 decoder_->set_log_commands(true); |
513 } | 525 } |
514 | 526 |
515 decoder_->GetLogger()->SetMsgCallback( | 527 decoder_->GetLogger()->SetMsgCallback( |
516 base::Bind(&GpuCommandBufferStub::SendConsoleMessage, | 528 base::Bind(&GpuCommandBufferStub::SendConsoleMessage, |
517 base::Unretained(this))); | 529 base::Unretained(this))); |
518 decoder_->SetShaderCacheCallback( | 530 decoder_->SetShaderCacheCallback( |
519 base::Bind(&GpuCommandBufferStub::SendCachedShader, | 531 base::Bind(&GpuCommandBufferStub::SendCachedShader, |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 if (surface_ && MakeCurrent()) | 945 if (surface_ && MakeCurrent()) |
934 surface_->SetFrontbufferAllocation( | 946 surface_->SetFrontbufferAllocation( |
935 allocation.browser_allocation.suggest_have_frontbuffer); | 947 allocation.browser_allocation.suggest_have_frontbuffer); |
936 } | 948 } |
937 | 949 |
938 last_memory_allocation_valid_ = true; | 950 last_memory_allocation_valid_ = true; |
939 last_memory_allocation_ = allocation; | 951 last_memory_allocation_ = allocation; |
940 } | 952 } |
941 | 953 |
942 } // namespace content | 954 } // namespace content |
OLD | NEW |