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

Unified Diff: content/browser/compositor/io_surface_layer_mac.mm

Issue 554043002: Log erros while presenting an IOSurface to about:gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/io_surface_layer_mac.mm
diff --git a/content/browser/compositor/io_surface_layer_mac.mm b/content/browser/compositor/io_surface_layer_mac.mm
index 1262386d41e544e367754db266939bec00d6b511..c0ea9e156593cb988f1c42796385db1701760bb4 100644
--- a/content/browser/compositor/io_surface_layer_mac.mm
+++ b/content/browser/compositor/io_surface_layer_mac.mm
@@ -4,6 +4,8 @@
#include "content/browser/compositor/io_surface_layer_mac.h"
+#include <sstream>
+
#include <CoreFoundation/CoreFoundation.h>
#include <OpenGL/CGLIOSurface.h>
#include <OpenGL/CGLRenderers.h>
@@ -11,6 +13,7 @@
#include "base/mac/mac_util.h"
#include "base/mac/sdk_forward_declarations.h"
+#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
#include "ui/base/cocoa/animation_utils.h"
@@ -24,6 +27,16 @@
LOG_IF(ERROR, gl_error != GL_NO_ERROR) << "GL Error: " << gl_error; \
} while (0)
+// Helper function for logging error codes.
+namespace {
+template<typename T>
+std::string to_string(T value) {
+ std::ostringstream stream;
+ stream << value;
+ return stream.str();
+}
+}
+
////////////////////////////////////////////////////////////////////////////////
// IOSurfaceLayer(Private)
@@ -159,7 +172,10 @@ void IOSurfaceLayerHelper::TimerFired() {
io_surface_.reset(IOSurfaceLookup(io_surface_id));
io_surface_texture_dirty_ = true;
if (!io_surface_) {
- LOG(ERROR) << "Failed to open IOSurface for frame";
+ content::GpuDataManagerImpl::GetInstance()->AddLogMessage(
+ logging::LOG_ERROR,
+ "IOSurfaceLayer",
+ "Failed to open IOSurface in gotFrameWithIOSurface");
if (client_)
client_->IOSurfaceLayerHitError();
}
@@ -274,10 +290,14 @@ void IOSurfaceLayerHelper::TimerFired() {
attribs.push_back(static_cast<CGLPixelFormatAttribute>(0));
GLint number_virtual_screens = 0;
base::ScopedTypeRef<CGLPixelFormatObj> pixel_format;
- CGLError error = CGLChoosePixelFormat(
+ CGLError cgl_error = CGLChoosePixelFormat(
&attribs.front(), pixel_format.InitializeInto(), &number_virtual_screens);
- if (error != kCGLNoError) {
- LOG(ERROR) << "Failed to create pixel format object.";
+ if (cgl_error != kCGLNoError) {
+ content::GpuDataManagerImpl::GetInstance()->AddLogMessage(
+ logging::LOG_ERROR,
+ "IOSurfaceLayer",
+ std::string("Failed to create pixel format object with CGL error ") +
+ to_string(static_cast<int>(cgl_error)));
return NULL;
}
return CGLRetainPixelFormat(pixel_format);
@@ -331,7 +351,11 @@ void IOSurfaceLayerHelper::TimerFired() {
0 /* plane */);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
if (cgl_error != kCGLNoError) {
- LOG(ERROR) << "CGLTexImageIOSurface2D failed with " << cgl_error;
+ content::GpuDataManagerImpl::GetInstance()->AddLogMessage(
+ logging::LOG_ERROR,
+ "IOSurfaceLayer",
+ std::string("CGLTexImageIOSurface2D failed with CGL error ") +
+ to_string(cgl_error));
glDeleteTextures(1, &io_surface_texture_);
io_surface_texture_ = 0;
if (client_)
@@ -384,6 +408,10 @@ void IOSurfaceLayerHelper::TimerFired() {
glBegin(GL_TRIANGLES);
glEnd();
} else {
+ content::GpuDataManagerImpl::GetInstance()->AddLogMessage(
+ logging::LOG_ERROR,
+ "IOSurfaceLayer",
+ std::string("No texture to draw, clearing to white"));
glClearColor(1, 1, 1, 1);
glClear(GL_COLOR_BUFFER_BIT);
}
@@ -395,15 +423,22 @@ void IOSurfaceLayerHelper::TimerFired() {
if (cgl_error == kCGLNoError) {
cgl_renderer_id_ &= kCGLRendererIDMatchingMask;
} else {
- LOG(ERROR) << "CGLGetParameter for kCGLCPCurrentRendererID failed with "
- << cgl_error;
+ content::GpuDataManagerImpl::GetInstance()->AddLogMessage(
+ logging::LOG_ERROR,
+ "IOSurfaceLayer",
+ std::string("CGLGetParameter for kCGLCPCurrentRendererID failed ") +
+ std::string("with CGL error ") + to_string(cgl_error));
cgl_renderer_id_ = 0;
}
}
// If we hit any errors, tell the client.
while (GLenum gl_error = glGetError()) {
- LOG(ERROR) << "Hit GL error " << gl_error;
+ content::GpuDataManagerImpl::GetInstance()->AddLogMessage(
+ logging::LOG_ERROR,
+ "IOSurfaceLayer",
+ std::string("Hit GL error ") + to_string(gl_error) +
+ std::string(" in drawInCGLContext"));
if (client_)
client_->IOSurfaceLayerHitError();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698