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

Side by Side Diff: ppapi/thunk/common.cc

Issue 6899055: PPAPI: Force async callback invocation option. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/thunk/common.h ('k') | ppapi/thunk/ppb_audio_trusted_thunk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/thunk/common.h"
6
7 #include "base/message_loop.h"
8 #include "ppapi/c/pp_errors.h"
9
10 namespace ppapi {
11 namespace thunk {
12
13 int32_t MayForceCallback(PP_CompletionCallback callback, int32_t result) {
14 if (result == PP_OK_COMPLETIONPENDING)
15 return result;
16
17 if (callback.func == NULL ||
18 (callback.flags & PP_COMPLETIONCALLBACK_FLAG_OPTIONAL) != 0)
19 return result;
20
21 // TODO(polina): make this work off the main thread as well
22 // (At this point this should not be an issue because PPAPI is only supported
23 // on the main thread).
24 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableFunction(
25 callback.func, callback.user_data, result));
26 return PP_OK_COMPLETIONPENDING;
27 }
28
29 } // namespace thunk
30 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/common.h ('k') | ppapi/thunk/ppb_audio_trusted_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698