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

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

Issue 16155009: Update webkit/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/test_webmessageportchannel.h" 5 #include "webkit/support/test_webmessageportchannel.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "third_party/WebKit/public/platform/WebMessagePortChannelClient.h" 10 #include "third_party/WebKit/public/platform/WebMessagePortChannelClient.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 Release(); 53 Release();
54 } 54 }
55 55
56 void TestWebMessagePortChannel::entangle(WebMessagePortChannel* remote) { 56 void TestWebMessagePortChannel::entangle(WebMessagePortChannel* remote) {
57 remote_ = static_cast<TestWebMessagePortChannel*>(remote); 57 remote_ = static_cast<TestWebMessagePortChannel*>(remote);
58 } 58 }
59 59
60 void TestWebMessagePortChannel::postMessage(const WebString& data, 60 void TestWebMessagePortChannel::postMessage(const WebString& data,
61 WebMessagePortChannelArray* ports) { 61 WebMessagePortChannelArray* ports) {
62 if (remote_ == NULL) 62 if (remote_.get() == NULL)
63 return; 63 return;
64 base::MessageLoop::current()->PostTask( 64 base::MessageLoop::current()->PostTask(
65 FROM_HERE, 65 FROM_HERE,
66 base::Bind(&TestWebMessagePortChannel::queueMessage, 66 base::Bind(&TestWebMessagePortChannel::queueMessage,
67 remote_.get(), 67 remote_.get(),
68 new Message(data, ports))); 68 new Message(data, ports)));
69 } 69 }
70 70
71 bool TestWebMessagePortChannel::tryGetMessage(WebString* data, 71 bool TestWebMessagePortChannel::tryGetMessage(WebString* data,
72 WebMessagePortChannelArray& ports) { 72 WebMessagePortChannelArray& ports) {
73 if (message_queue_.empty()) 73 if (message_queue_.empty())
74 return false; 74 return false;
75 scoped_ptr<Message> message(message_queue_.front()); 75 scoped_ptr<Message> message(message_queue_.front());
76 message_queue_.pop(); 76 message_queue_.pop();
77 *data = message->data(); 77 *data = message->data();
78 if (WebMessagePortChannelArray* message_ports = message->ports()) 78 if (WebMessagePortChannelArray* message_ports = message->ports())
79 ports.swap(*message_ports); 79 ports.swap(*message_ports);
80 return true; 80 return true;
81 } 81 }
82 82
83 TestWebMessagePortChannel::~TestWebMessagePortChannel() {} 83 TestWebMessagePortChannel::~TestWebMessagePortChannel() {}
84 84
85 void TestWebMessagePortChannel::queueMessage(Message* message) { 85 void TestWebMessagePortChannel::queueMessage(Message* message) {
86 bool was_empty = message_queue_.empty(); 86 bool was_empty = message_queue_.empty();
87 message_queue_.push(message); 87 message_queue_.push(message);
88 if (client_ && was_empty) 88 if (client_ && was_empty)
89 client_->messageAvailable(); 89 client_->messageAvailable();
90 } 90 }
OLDNEW
« no previous file with comments | « webkit/support/test_webkit_platform_support.cc ('k') | webkit/tools/test_shell/simple_dom_storage_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698