Index: content/common/gpu/media/avda_return_on_failure.h |
diff --git a/content/common/gpu/media/avda_return_on_failure.h b/content/common/gpu/media/avda_return_on_failure.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3d6d559f4208aa49d0592e2f4c3c84ea7ffdee46 |
--- /dev/null |
+++ b/content/common/gpu/media/avda_return_on_failure.h |
@@ -0,0 +1,22 @@ |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_COMMON_GPU_MEDIA_AVDA_RETURN_ON_FAILURE_H_ |
+#define CONTENT_COMMON_GPU_MEDIA_AVDA_RETURN_ON_FAILURE_H_ |
+ |
+// Helper macros for dealing with failure. If |result| evaluates false, emit |
+// |log| to ERROR, register |error| with the decoder, and return. This will |
+// also transition to the error state, stopping further decoding. |
+// This is meant to be used only within AndroidVideoDecoderBase and its |
+// various subclasses. |
+#define RETURN_ON_FAILURE(result, log, error) \ |
+ do { \ |
+ if (!(result)) { \ |
+ DLOG(ERROR) << log; \ |
+ PostError(FROM_HERE, error); \ |
+ return; \ |
+ } \ |
+ } while (0) |
+ |
+#endif // CONTENT_COMMON_GPU_MEDIA_AVDA_RETURN_ON_FAILURE_H_ |