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. 4 5#ifndef PPAPI_THUNK_PPB_MESSAGE_LOOP_API_H_ 6#define PPAPI_THUNK_PPB_MESSAGE_LOOP_API_H_ 7 8#include "base/memory/ref_counted.h" 9#include "ppapi/c/pp_bool.h" 10#include "ppapi/c/pp_completion_callback.h" 11#include "ppapi/c/pp_stdint.h" 12#include "ppapi/thunk/ppapi_thunk_export.h" 13 14namespace ppapi { 15 16class TrackedCallback; 17 18namespace thunk { 19 20class PPAPI_THUNK_EXPORT PPB_MessageLoop_API { 21 public: 22 virtual ~PPB_MessageLoop_API() {} 23 24 virtual int32_t AttachToCurrentThread() = 0; 25 virtual int32_t Run() = 0; 26 // Note: Most interfaces should use scoped_refptr<TrackedCallback>, in order 27 // to track callbacks and support things like blocking or optional callbacks. 28 // In this case, the callback is really just a way to pass a function pointer, 29 // and those options don't make sense. 30 virtual int32_t PostWork(PP_CompletionCallback callback, 31 int64_t delay_ms) = 0; 32 virtual int32_t PostQuit(PP_Bool should_destroy) = 0; 33}; 34 35} // namespace thunk 36} // namespace ppapi 37 38#endif // PPAPI_THUNK_PPB_MESSAGE_LOOP_API_H_ 39