| Index: gpu/command_buffer/client/gles2_implementation.cc
|
| diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
|
| index c155af501ebddd0c9158dc2b0389e27bb5e70dd8..194ccfe3f0fac754c651c1580173900cdd8489cc 100644
|
| --- a/gpu/command_buffer/client/gles2_implementation.cc
|
| +++ b/gpu/command_buffer/client/gles2_implementation.cc
|
| @@ -83,11 +83,12 @@ GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() {
|
| }
|
|
|
| GLES2Implementation::GLES2Implementation(
|
| - GLES2CmdHelper* helper,
|
| - ShareGroup* share_group,
|
| - TransferBufferInterface* transfer_buffer,
|
| - bool bind_generates_resource,
|
| - GpuControl* gpu_control)
|
| + GLES2CmdHelper* helper,
|
| + ShareGroup* share_group,
|
| + TransferBufferInterface* transfer_buffer,
|
| + bool bind_generates_resource,
|
| + bool lose_context_when_out_of_memory,
|
| + GpuControl* gpu_control)
|
| : helper_(helper),
|
| transfer_buffer_(transfer_buffer),
|
| angle_pack_reverse_row_order_status_(kUnknownExtensionStatus),
|
| @@ -113,6 +114,7 @@ GLES2Implementation::GLES2Implementation(
|
| async_upload_sync_shm_offset_(0),
|
| error_bits_(0),
|
| debug_(false),
|
| + lose_context_when_out_of_memory_(lose_context_when_out_of_memory),
|
| use_count_(0),
|
| error_message_callback_(NULL),
|
| gpu_control_(gpu_control),
|
| @@ -504,6 +506,11 @@ void GLES2Implementation::SetGLError(
|
| error_message_callback_->OnErrorMessage(temp.c_str(), 0);
|
| }
|
| error_bits_ |= GLES2Util::GLErrorToErrorBit(error);
|
| +
|
| + if (error == GL_OUT_OF_MEMORY && lose_context_when_out_of_memory_) {
|
| + helper_->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
|
| + GL_UNKNOWN_CONTEXT_RESET_ARB);
|
| + }
|
| }
|
|
|
| void GLES2Implementation::SetGLErrorInvalidEnum(
|
| @@ -891,16 +898,6 @@ void GLES2Implementation::ShallowFinishCHROMIUM() {
|
| helper_->CommandBufferHelper::Finish();
|
| }
|
|
|
| -bool GLES2Implementation::MustBeContextLost() {
|
| - bool context_lost = helper_->IsContextLost();
|
| - if (!context_lost) {
|
| - WaitForCmd();
|
| - context_lost = helper_->IsContextLost();
|
| - }
|
| - CHECK(context_lost);
|
| - return context_lost;
|
| -}
|
| -
|
| void GLES2Implementation::FinishHelper() {
|
| GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFinish()");
|
| TRACE_EVENT0("gpu", "GLES2::Finish");
|
| @@ -3330,7 +3327,9 @@ void GLES2Implementation::BeginQueryEXT(GLenum target, GLuint id) {
|
| if (!query) {
|
| query = query_tracker_->CreateQuery(id, target);
|
| if (!query) {
|
| - MustBeContextLost();
|
| + SetGLError(GL_OUT_OF_MEMORY,
|
| + "glBeginQueryEXT",
|
| + "transfer buffer allocation failed");
|
| return;
|
| }
|
| } else if (query->target() != target) {
|
|
|