Introduce AndroidMetricsProvider class.
[chromium-blink-merge.git] / ppapi / thunk / ppb_flash_message_loop_thunk.cc
blob583bc49a66e9a13fb975e69093622513c59d9a5f
1 // Copyright (c) 2012 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.
5 #include "ppapi/c/pp_bool.h"
6 #include "ppapi/c/pp_errors.h"
7 #include "ppapi/thunk/enter.h"
8 #include "ppapi/thunk/ppb_flash_message_loop_api.h"
9 #include "ppapi/thunk/resource_creation_api.h"
10 #include "ppapi/thunk/thunk.h"
12 namespace ppapi {
13 namespace thunk {
15 namespace {
17 PP_Resource Create(PP_Instance instance) {
18 EnterResourceCreation enter(instance);
19 if (enter.failed())
20 return 0;
21 return enter.functions()->CreateFlashMessageLoop(instance);
24 PP_Bool IsFlashMessageLoop(PP_Resource resource) {
25 EnterResource<PPB_Flash_MessageLoop_API> enter(resource, false);
26 return PP_FromBool(enter.succeeded());
29 int32_t Run(PP_Resource resource) {
30 EnterResource<PPB_Flash_MessageLoop_API> enter(resource, true);
31 if (enter.failed())
32 return PP_ERROR_BADRESOURCE;
33 return enter.object()->Run();
36 void Quit(PP_Resource resource) {
37 EnterResource<PPB_Flash_MessageLoop_API> enter(resource, true);
38 if (enter.succeeded())
39 enter.object()->Quit();
42 const PPB_Flash_MessageLoop g_ppb_flash_message_loop_thunk = {
43 &Create,
44 &IsFlashMessageLoop,
45 &Run,
46 &Quit
49 } // namespace
51 const PPB_Flash_MessageLoop_0_1* GetPPB_Flash_MessageLoop_0_1_Thunk() {
52 return &g_ppb_flash_message_loop_thunk;
55 } // namespace thunk
56 } // namespace ppapi