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

Side by Side Diff: media/gpu/avda_return_on_failure.h

Issue 1882373004: Migrate content/common/gpu/media code to media/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix several more bot-identified build issues Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_GPU_MEDIA_AVDA_RETURN_ON_FAILURE_H_ 5 #ifndef MEDIA_GPU_AVDA_RETURN_ON_FAILURE_H_
6 #define CONTENT_COMMON_GPU_MEDIA_AVDA_RETURN_ON_FAILURE_H_ 6 #define MEDIA_GPU_AVDA_RETURN_ON_FAILURE_H_
7 7
8 #include "media/video/video_decode_accelerator.h" 8 #include "media/video/video_decode_accelerator.h"
9 9
10 // Helper macros for dealing with failure. If |result| evaluates false, emit 10 // Helper macros for dealing with failure. If |result| evaluates false, emit
11 // |log| to ERROR, register |error| with the decoder, and return. This will 11 // |log| to ERROR, register |error| with the decoder, and return. This will
12 // also transition to the error state, stopping further decoding. 12 // also transition to the error state, stopping further decoding.
13 // This is meant to be used only within AndroidVideoDecoder and the various 13 // This is meant to be used only within AndroidVideoDecoder and the various
14 // backing strategies. |provider| must support PostError. The varargs 14 // backing strategies. |provider| must support PostError. The varargs
15 // can be used for the return value. 15 // can be used for the return value.
16 #define RETURN_ON_FAILURE(provider, result, log, error, ...) \ 16 #define RETURN_ON_FAILURE(provider, result, log, error, ...) \
17 do { \ 17 do { \
18 if (!(result)) { \ 18 if (!(result)) { \
19 DLOG(ERROR) << log; \ 19 DLOG(ERROR) << log; \
20 provider->PostError(FROM_HERE, media::VideoDecodeAccelerator::error); \ 20 provider->PostError(FROM_HERE, media::VideoDecodeAccelerator::error); \
21 return __VA_ARGS__; \ 21 return __VA_ARGS__; \
22 } \ 22 } \
23 } while (0) 23 } while (0)
24 24
25 // Similar to the above, with some handy boilerplate savings. The varargs 25 // Similar to the above, with some handy boilerplate savings. The varargs
26 // can be used for the return value. 26 // can be used for the return value.
27 #define RETURN_IF_NULL(ptr, ...) \ 27 #define RETURN_IF_NULL(ptr, ...) \
28 RETURN_ON_FAILURE(state_provider_, ptr, "Got null for " << #ptr, \ 28 RETURN_ON_FAILURE(state_provider_, ptr, "Got null for " << #ptr, \
29 ILLEGAL_STATE, ##__VA_ARGS__); 29 ILLEGAL_STATE, ##__VA_ARGS__);
30 30
31 // Return null if !ptr. 31 // Return null if !ptr.
32 #define RETURN_NULL_IF_NULL(ptr) RETURN_IF_NULL(ptr, 0) 32 #define RETURN_NULL_IF_NULL(ptr) RETURN_IF_NULL(ptr, 0)
33 33
34 #endif // CONTENT_COMMON_GPU_MEDIA_AVDA_RETURN_ON_FAILURE_H_ 34 #endif // MEDIA_GPU_AVDA_RETURN_ON_FAILURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698