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

Unified Diff: chrome/common/net/thread_blocker.h

Issue 2802015: Massively simplify the NetworkChangeNotifier infrastructure:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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
Index: chrome/common/net/thread_blocker.h
===================================================================
--- chrome/common/net/thread_blocker.h (revision 50775)
+++ chrome/common/net/thread_blocker.h (working copy)
@@ -1,51 +0,0 @@
-// Copyright (c) 2010 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 CHROME_COMMON_NET_THREAD_BLOCKER_H_
-#define CHROME_COMMON_NET_THREAD_BLOCKER_H_
-
-// This class (mainly used for testing) lets you block and unblock a
-// thread at will.
-//
-// TODO(akalin): Consider moving this to base/ as this class is not
-// sync-specific (ask darin about it).
-
-#include "base/basictypes.h"
-#include "base/waitable_event.h"
-
-class MessageLoop;
-
-namespace base {
-class Thread;
-} // namespace base
-
-namespace chrome_common_net {
-
-class ThreadBlocker {
- public:
- // The given thread must already be started and it must outlive this
- // instance.
- explicit ThreadBlocker(base::Thread* target_thread);
-
- // When this function returns, the target thread will be blocked
- // until Unblock() is called. Each call to Block() must be matched
- // by a call to Unblock().
- void Block();
-
- // When this function returns, the target thread is unblocked.
- void Unblock();
-
- private:
- // On the target thread, blocks until Unblock() is called.
- void BlockOnTargetThread();
-
- MessageLoop* const target_message_loop_;
- base::WaitableEvent is_blocked_, is_finished_blocking_, is_unblocked_;
-
- DISALLOW_COPY_AND_ASSIGN(ThreadBlocker);
-};
-
-} // namespace chrome_common_net
-
-#endif // CHROME_COMMON_NET_THREAD_BLOCKER_H_

Powered by Google App Engine
This is Rietveld 408576698