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

Unified Diff: ppapi/utility/threading/simple_thread.h

Issue 9290040: Revert 119198 - First pass at implementing the MessageLoop interface. This includes a simple (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/thunk/ppb_message_loop_api.h ('k') | ppapi/utility/threading/simple_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/utility/threading/simple_thread.h
===================================================================
--- ppapi/utility/threading/simple_thread.h (revision 119199)
+++ ppapi/utility/threading/simple_thread.h (working copy)
@@ -1,65 +0,0 @@
-// Copyright (c) 2012 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 PPAPI_UTILITY_THREADING_SIMPLE_THREAD_H_
-#define PPAPI_UTILITY_THREADING_SIMPLE_THREAD_H_
-
-#ifdef WIN32
-#include <windows.h>
-#else
-#include <pthread.h>
-#endif
-
-#include "ppapi/cpp/dev/message_loop_dev.h"
-
-namespace pp {
-
-// This class is a simple wrapper around a pthread/Windows thread that creates
-// and runs a PPAPI message loop on that thread.
-class SimpleThread {
- public:
-#ifdef WIN32
- typedef HANDLE ThreadHandle;
-#else
- typedef pthread_t ThreadHandle;
-#endif
-
- typedef void (*ThreadFunc)(MessageLoop_Dev&, void* user_data);
-
- SimpleThread(Instance* instance);
- ~SimpleThread();
-
- // Starts a thread and runs a message loop in it. If you need control over
- // how the message loop is run, use StartWithFunction. Returns true on
- // success, false if the thread is already running or couldn't be started.
- bool Start();
-
- // Posts a quit message to the message loop and blocks until the thread
- // exits. Returns true on success. If the thread is not running, returns
- // false.
- bool Join();
-
- // Normally you can just use Start() to start a thread, and then post work to
- // it. In some cases you will want control over the message. If ThreadFunc
- // is NULL, this acts the same as Start().
- bool StartWithFunction(ThreadFunc func, void* user_data);
-
- MessageLoop_Dev& message_loop() { return message_loop_; }
- ThreadHandle thread() const { return thread_; }
-
- private:
- Instance* instance_;
- MessageLoop_Dev message_loop_;
-
- ThreadHandle thread_;
-
- // Disallow (not implemented).
- SimpleThread(const SimpleThread&);
- SimpleThread& operator=(const SimpleThread&);
-};
-
-} // namespace pp
-
-#endif // PPAPI_UTILITY_THREADING_SIMPLE_THREAD_H_
-
« no previous file with comments | « ppapi/thunk/ppb_message_loop_api.h ('k') | ppapi/utility/threading/simple_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698