| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "core/dom/ExecutionContext.h" | 34 #include "core/dom/ExecutionContext.h" |
| 35 #include "core/dom/ExecutionContextTask.h" | 35 #include "core/dom/ExecutionContextTask.h" |
| 36 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
| 37 | 37 |
| 38 namespace WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 class DispatchCallbackTask : public ExecutionContextTask { | 42 class DispatchCallbackTask : public ExecutionContextTask { |
| 43 public: | 43 public: |
| 44 static PassOwnPtr<DispatchCallbackTask> create(PassRefPtr<StringCallback> ca
llback, const String& data) | 44 static PassOwnPtr<DispatchCallbackTask> create(PassOwnPtr<StringCallback> ca
llback, const String& data) |
| 45 { | 45 { |
| 46 return adoptPtr(new DispatchCallbackTask(callback, data)); | 46 return adoptPtr(new DispatchCallbackTask(callback, data)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 virtual void performTask(ExecutionContext*) | 49 virtual void performTask(ExecutionContext*) |
| 50 { | 50 { |
| 51 m_callback->handleEvent(m_data); | 51 m_callback->handleEvent(m_data); |
| 52 } | 52 } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 DispatchCallbackTask(PassRefPtr<StringCallback> callback, const String& data
) | 55 DispatchCallbackTask(PassOwnPtr<StringCallback> callback, const String& data
) |
| 56 : m_callback(callback) | 56 : m_callback(callback) |
| 57 , m_data(data) | 57 , m_data(data) |
| 58 { | 58 { |
| 59 } | 59 } |
| 60 | 60 |
| 61 RefPtr<StringCallback> m_callback; | 61 OwnPtr<StringCallback> m_callback; |
| 62 const String m_data; | 62 const String m_data; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 void StringCallback::scheduleCallback(ExecutionContext* context, const String& d
ata) | 67 void StringCallback::scheduleCallback(PassOwnPtr<StringCallback> callback, Execu
tionContext* context, const String& data) |
| 68 { | 68 { |
| 69 context->postTask(DispatchCallbackTask::create(this, data)); | 69 context->postTask(DispatchCallbackTask::create(callback, data)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace WebCore | 72 } // namespace WebCore |
| OLD | NEW |