| Index: gpu/command_buffer/client/gles2_implementation.cc
|
| ===================================================================
|
| --- gpu/command_buffer/client/gles2_implementation.cc (revision 261814)
|
| +++ gpu/command_buffer/client/gles2_implementation.cc (working copy)
|
| @@ -82,11 +82,12 @@
|
| }
|
|
|
| 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),
|
| @@ -108,6 +109,7 @@
|
| bound_pixel_unpack_transfer_buffer_id_(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),
|
| @@ -483,6 +485,11 @@
|
| 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(
|
| @@ -870,16 +877,6 @@
|
| 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");
|
| @@ -3292,7 +3289,9 @@
|
| 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) {
|
|
|