Skip to content

Commit

Permalink
Added facility to stub log and check. It is still not ideal but worka…
Browse files Browse the repository at this point in the history
…ble.

Review URL: http://codereview.chromium.org/1697002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45192 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
alokp@chromium.org committed Apr 21, 2010
1 parent 836b3b3 commit 5587489
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
4 changes: 2 additions & 2 deletions gpu/command_buffer/client/cmd_buffer_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void CommandBufferHelper::WaitForToken(int32 token) {
Flush();
while (last_token_read_ < token) {
if (get_ == put_) {
GPU_LOG(FATAL) << "Empty command buffer while waiting on a token.";
LOG(FATAL) << "Empty command buffer while waiting on a token.";
return;
}
// Do not loop forever if the flush fails, meaning the command buffer reader
Expand All @@ -99,7 +99,7 @@ void CommandBufferHelper::WaitForToken(int32 token) {
// The function will return early if an error occurs, in which case the
// available space may not be available.
void CommandBufferHelper::WaitForAvailableEntries(int32 count) {
GPU_CHECK(count < entry_count_);
CHECK(count < entry_count_);
if (put_ + count > entry_count_) {
// There's not enough room between the current put and the end of the
// buffer, so we need to wrap. We will add noops all the way to the end,
Expand Down
28 changes: 9 additions & 19 deletions gpu/command_buffer/common/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This file abstracts differences in logging between NaCl and host
// environment.
// This file provides ability to stub LOG and CHECK.

#ifndef GPU_COMMAND_BUFFER_COMMON_LOGGING_H_
#define GPU_COMMAND_BUFFER_COMMON_LOGGING_H_

#ifndef __native_client__
#if defined(TRUSTED_GPU_LIBRARY_BUILD)
// Turn off base/logging macros for the trusted library build.
// TODO(dspringer): remove this once building trusted plugins in the Native
// Client SDK is no longer needed.
#define OMIT_DLOG_AND_DCHECK 1
#define GPU_LOG DLOG
#define GPU_CHECK DCHECK
#else
#define GPU_LOG LOG
#define GPU_CHECK CHECK
#endif // defined(TRUSTED_GPU_LIBRARY_BUILD)
#include "base/logging.h"
#else
#if defined(__native_client__)
#define STUB_LOG_AND_CHECK 1
#endif // __native_client__

#if defined STUB_LOG_AND_CHECK
#include <sstream>

#define GPU_LOG LOG
#define GPU_CHECK CHECK
// TODO: implement logging through nacl's debug service runtime if
// available.
#define CHECK(X) do {} while (0)
Expand All @@ -49,6 +37,8 @@

#define NOTREACHED() DCHECK(false)

#endif
#else // STUB_LOG_AND_CHECK
#include "base/logging.h"
#endif // STUB_LOG_AND_CHECK

#endif // GPU_COMMAND_BUFFER_COMMON_LOGGING_H_

0 comments on commit 5587489

Please sign in to comment.