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

Unified Diff: ppapi/proxy/ppb_message_loop_proxy.cc

Issue 2132593002: Remove remaining calls to deprecated MessageLoop methods on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: h264_vt_encoder_unittest.cc Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppb_message_loop_proxy.h ('k') | remoting/client/client_status_logger_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_message_loop_proxy.cc
diff --git a/ppapi/proxy/ppb_message_loop_proxy.cc b/ppapi/proxy/ppb_message_loop_proxy.cc
index 7f2fc337849720be301957626cfdaeb472f288f0..ac78eb9ad29745551bd4231313eb185848a25659 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.cc
+++ b/ppapi/proxy/ppb_message_loop_proxy.cc
@@ -9,8 +9,9 @@
#include <vector>
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/compiler_specific.h"
-#include "base/location.h"
+#include "base/logging.h"
#include "base/threading/thread_task_runner_handle.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_message_loop.h"
@@ -109,11 +110,17 @@ int32_t MessageLoopResource::Run() {
if (is_main_thread_loop_)
return PP_ERROR_INPROGRESS;
+ base::RunLoop* previous_run_loop = run_loop_;
+ base::RunLoop run_loop;
+ run_loop_ = &run_loop;
+
nested_invocations_++;
CallWhileUnlocked(
- base::Bind(&base::MessageLoop::Run, base::Unretained(loop_.get())));
+ base::Bind(&base::RunLoop::Run, base::Unretained(run_loop_)));
nested_invocations_--;
+ run_loop_ = previous_run_loop;
+
if (should_destroy_ && nested_invocations_ == 0) {
task_runner_ = NULL;
loop_.reset();
@@ -142,10 +149,13 @@ int32_t MessageLoopResource::PostQuit(PP_Bool should_destroy) {
if (PP_ToBool(should_destroy))
should_destroy_ = true;
- if (IsCurrent() && nested_invocations_ > 0)
- loop_->QuitWhenIdle();
- else
- PostClosure(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 0);
+ if (IsCurrent() && nested_invocations_ > 0) {
+ run_loop_->QuitWhenIdle();
+ } else {
+ PostClosure(FROM_HERE, base::Bind(&MessageLoopResource::QuitRunLoopWhenIdle,
+ Unretained(this)),
+ 0);
+ }
return PP_OK;
}
@@ -201,6 +211,12 @@ bool MessageLoopResource::CurrentlyHandlingBlockingMessage() {
return currently_handling_blocking_message_;
}
+void MessageLoopResource::QuitRunLoopWhenIdle() {
+ DCHECK(IsCurrent());
+ DCHECK(run_loop_);
+ run_loop_->QuitWhenIdle();
+}
+
// static
void MessageLoopResource::ReleaseMessageLoop(void* value) {
static_cast<MessageLoopResource*>(value)->DetachFromThread();
« no previous file with comments | « ppapi/proxy/ppb_message_loop_proxy.h ('k') | remoting/client/client_status_logger_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698