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

Side by Side Diff: webkit/child/webthread_impl.cc

Issue 61553006: Rename WebKit namespace to blink (part 5) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/child/webthread_impl.h ('k') | webkit/child/weburlloader_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // An implementation of WebThread in terms of base::MessageLoop and 5 // An implementation of WebThread in terms of base::MessageLoop and
6 // base::Thread 6 // base::Thread
7 7
8 #include "webkit/child/webthread_impl.h" 8 #include "webkit/child/webthread_impl.h"
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 task_observer_map_.erase(iter); 55 task_observer_map_.erase(iter);
56 } 56 }
57 57
58 WebThreadImpl::WebThreadImpl(const char* name) 58 WebThreadImpl::WebThreadImpl(const char* name)
59 : thread_(new base::Thread(name)) { 59 : thread_(new base::Thread(name)) {
60 thread_->Start(); 60 thread_->Start();
61 } 61 }
62 62
63 void WebThreadImpl::postTask(Task* task) { 63 void WebThreadImpl::postTask(Task* task) {
64 thread_->message_loop()->PostTask( 64 thread_->message_loop()->PostTask(
65 FROM_HERE, base::Bind(&WebKit::WebThread::Task::run, base::Owned(task))); 65 FROM_HERE, base::Bind(&blink::WebThread::Task::run, base::Owned(task)));
66 } 66 }
67 67
68 void WebThreadImpl::postDelayedTask( 68 void WebThreadImpl::postDelayedTask(
69 Task* task, long long delay_ms) { 69 Task* task, long long delay_ms) {
70 thread_->message_loop()->PostDelayedTask( 70 thread_->message_loop()->PostDelayedTask(
71 FROM_HERE, 71 FROM_HERE,
72 base::Bind(&WebKit::WebThread::Task::run, base::Owned(task)), 72 base::Bind(&blink::WebThread::Task::run, base::Owned(task)),
73 base::TimeDelta::FromMilliseconds(delay_ms)); 73 base::TimeDelta::FromMilliseconds(delay_ms));
74 } 74 }
75 75
76 void WebThreadImpl::enterRunLoop() { 76 void WebThreadImpl::enterRunLoop() {
77 CHECK(isCurrentThread()); 77 CHECK(isCurrentThread());
78 CHECK(!thread_->message_loop()->is_running()); // We don't support nesting. 78 CHECK(!thread_->message_loop()->is_running()); // We don't support nesting.
79 thread_->message_loop()->Run(); 79 thread_->message_loop()->Run();
80 } 80 }
81 81
82 void WebThreadImpl::exitRunLoop() { 82 void WebThreadImpl::exitRunLoop() {
(...skipping 10 matching lines...) Expand all
93 thread_->Stop(); 93 thread_->Stop();
94 } 94 }
95 95
96 WebThreadImplForMessageLoop::WebThreadImplForMessageLoop( 96 WebThreadImplForMessageLoop::WebThreadImplForMessageLoop(
97 base::MessageLoopProxy* message_loop) 97 base::MessageLoopProxy* message_loop)
98 : message_loop_(message_loop) { 98 : message_loop_(message_loop) {
99 } 99 }
100 100
101 void WebThreadImplForMessageLoop::postTask(Task* task) { 101 void WebThreadImplForMessageLoop::postTask(Task* task) {
102 message_loop_->PostTask( 102 message_loop_->PostTask(
103 FROM_HERE, base::Bind(&WebKit::WebThread::Task::run, base::Owned(task))); 103 FROM_HERE, base::Bind(&blink::WebThread::Task::run, base::Owned(task)));
104 } 104 }
105 105
106 void WebThreadImplForMessageLoop::postDelayedTask( 106 void WebThreadImplForMessageLoop::postDelayedTask(
107 Task* task, long long delay_ms) { 107 Task* task, long long delay_ms) {
108 message_loop_->PostDelayedTask( 108 message_loop_->PostDelayedTask(
109 FROM_HERE, 109 FROM_HERE,
110 base::Bind(&WebKit::WebThread::Task::run, base::Owned(task)), 110 base::Bind(&blink::WebThread::Task::run, base::Owned(task)),
111 base::TimeDelta::FromMilliseconds(delay_ms)); 111 base::TimeDelta::FromMilliseconds(delay_ms));
112 } 112 }
113 113
114 void WebThreadImplForMessageLoop::enterRunLoop() { 114 void WebThreadImplForMessageLoop::enterRunLoop() {
115 CHECK(isCurrentThread()); 115 CHECK(isCurrentThread());
116 CHECK(!base::MessageLoop::current() 116 CHECK(!base::MessageLoop::current()
117 ->is_running()); // We don't support nesting. 117 ->is_running()); // We don't support nesting.
118 base::MessageLoop::current()->Run(); 118 base::MessageLoop::current()->Run();
119 } 119 }
120 120
121 void WebThreadImplForMessageLoop::exitRunLoop() { 121 void WebThreadImplForMessageLoop::exitRunLoop() {
122 CHECK(isCurrentThread()); 122 CHECK(isCurrentThread());
123 CHECK(base::MessageLoop::current()->is_running()); 123 CHECK(base::MessageLoop::current()->is_running());
124 base::MessageLoop::current()->Quit(); 124 base::MessageLoop::current()->Quit();
125 } 125 }
126 126
127 bool WebThreadImplForMessageLoop::isCurrentThread() const { 127 bool WebThreadImplForMessageLoop::isCurrentThread() const {
128 return message_loop_->BelongsToCurrentThread(); 128 return message_loop_->BelongsToCurrentThread();
129 } 129 }
130 130
131 WebThreadImplForMessageLoop::~WebThreadImplForMessageLoop() { 131 WebThreadImplForMessageLoop::~WebThreadImplForMessageLoop() {
132 } 132 }
133 133
134 } 134 }
OLDNEW
« no previous file with comments | « webkit/child/webthread_impl.h ('k') | webkit/child/weburlloader_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698