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

Side by Side Diff: webkit/support/webkit_support.cc

Issue 8550010: base::Bind() conversion for webkit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 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/glue/weburlloader_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "webkit/support/webkit_support.h" 5 #include "webkit/support/webkit_support.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h"
10 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 11 #include "base/command_line.h"
10 #include "base/debug/debugger.h" 12 #include "base/debug/debugger.h"
11 #include "base/file_path.h" 13 #include "base/file_path.h"
12 #include "base/file_util.h" 14 #include "base/file_util.h"
13 #include "base/i18n/icu_util.h" 15 #include "base/i18n/icu_util.h"
14 #include "base/logging.h" 16 #include "base/logging.h"
15 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
17 #include "base/message_loop.h" 19 #include "base/message_loop.h"
18 #include "base/path_service.h" 20 #include "base/path_service.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 message_loop_->Run(); 202 message_loop_->Run();
201 message_loop_->SetNestableTasksAllowed(old_state); 203 message_loop_->SetNestableTasksAllowed(old_state);
202 } 204 }
203 virtual void quitNow() { 205 virtual void quitNow() {
204 message_loop_->QuitNow(); 206 message_loop_->QuitNow();
205 } 207 }
206 private: 208 private:
207 MessageLoop* message_loop_; 209 MessageLoop* message_loop_;
208 }; 210 };
209 211
210 // An wrapper object for giving TaskAdaptor ref-countability,
211 // which NewRunnableMethod() requires.
212 class TaskAdaptorHolder : public CancelableTask {
213 public:
214 explicit TaskAdaptorHolder(webkit_support::TaskAdaptor* adaptor)
215 : adaptor_(adaptor) {
216 }
217
218 virtual void Run() {
219 adaptor_->Run();
220 }
221
222 virtual void Cancel() {
223 adaptor_.reset();
224 }
225
226 private:
227 scoped_ptr<webkit_support::TaskAdaptor> adaptor_;
228 };
229
230 webkit_support::GraphicsContext3DImplementation 212 webkit_support::GraphicsContext3DImplementation
231 g_graphics_context_3d_implementation = 213 g_graphics_context_3d_implementation =
232 webkit_support::IN_PROCESS_COMMAND_BUFFER; 214 webkit_support::IN_PROCESS_COMMAND_BUFFER;
233 215
234 } // namespace 216 } // namespace
235 217
236 namespace webkit_support { 218 namespace webkit_support {
237 219
238 static TestEnvironment* test_environment; 220 static TestEnvironment* test_environment;
239 221
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 current->RunAllPending(); 403 current->RunAllPending();
422 current->SetNestableTasksAllowed(old_state); 404 current->SetNestableTasksAllowed(old_state);
423 } 405 }
424 406
425 WebDevToolsAgentClient::WebKitClientMessageLoop* CreateDevToolsMessageLoop() { 407 WebDevToolsAgentClient::WebKitClientMessageLoop* CreateDevToolsMessageLoop() {
426 return new WebKitClientMessageLoopImpl(); 408 return new WebKitClientMessageLoopImpl();
427 } 409 }
428 410
429 void PostDelayedTask(void (*func)(void*), void* context, int64 delay_ms) { 411 void PostDelayedTask(void (*func)(void*), void* context, int64 delay_ms) {
430 MessageLoop::current()->PostDelayedTask( 412 MessageLoop::current()->PostDelayedTask(
431 FROM_HERE, NewRunnableFunction(func, context), delay_ms); 413 FROM_HERE, base::Bind(func, context), delay_ms);
432 } 414 }
433 415
434 void PostDelayedTask(TaskAdaptor* task, int64 delay_ms) { 416 void PostDelayedTask(TaskAdaptor* task, int64 delay_ms) {
435 MessageLoop::current()->PostDelayedTask( 417 MessageLoop::current()->PostDelayedTask(
436 FROM_HERE, new TaskAdaptorHolder(task), delay_ms); 418 FROM_HERE, base::Bind(&TaskAdaptor::Run, base::Owned(task)), delay_ms);
437 } 419 }
438 420
439 // Wrappers for FilePath and file_util 421 // Wrappers for FilePath and file_util
440 422
441 WebString GetAbsoluteWebStringFromUTF8Path(const std::string& utf8_path) { 423 WebString GetAbsoluteWebStringFromUTF8Path(const std::string& utf8_path) {
442 #if defined(OS_WIN) 424 #if defined(OS_WIN)
443 FilePath path(UTF8ToWide(utf8_path)); 425 FilePath path(UTF8ToWide(utf8_path));
444 file_util::AbsolutePath(&path); 426 file_util::AbsolutePath(&path);
445 return WebString(path.value()); 427 return WebString(path.value());
446 #else 428 #else
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 // Logging 626 // Logging
645 void EnableWebCoreLogChannels(const std::string& channels) { 627 void EnableWebCoreLogChannels(const std::string& channels) {
646 webkit_glue::EnableWebCoreLogChannels(channels); 628 webkit_glue::EnableWebCoreLogChannels(channels);
647 } 629 }
648 630
649 void SetGamepadData(const WebKit::WebGamepads& pads) { 631 void SetGamepadData(const WebKit::WebGamepads& pads) {
650 test_environment->webkit_platform_support()->setGamepadData(pads); 632 test_environment->webkit_platform_support()->setGamepadData(pads);
651 } 633 }
652 634
653 } // namespace webkit_support 635 } // namespace webkit_support
OLDNEW
« no previous file with comments | « webkit/glue/weburlloader_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698