OLD | NEW |
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 #include "mojo/services/native_viewport/native_viewport_controller.h" | 5 #include "mojo/services/native_viewport/native_viewport_controller.h" |
6 | 6 |
| 7 #include <limits> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
10 #include "gpu/command_buffer/client/gl_in_process_context.h" | 12 #include "gpu/command_buffer/client/gl_in_process_context.h" |
11 #include "gpu/command_buffer/client/gles2_implementation.h" | 13 #include "gpu/command_buffer/client/gles2_implementation.h" |
12 #include "mojo/services/native_viewport/native_viewport.h" | 14 #include "mojo/services/native_viewport/native_viewport.h" |
13 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
14 | 16 |
15 namespace mojo { | 17 namespace mojo { |
16 namespace services { | 18 namespace services { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 SendString(base::StringPrintf("Sized to: %d x %d", | 65 SendString(base::StringPrintf("Sized to: %d x %d", |
64 size.width(), | 66 size.width(), |
65 size.height())); | 67 size.height())); |
66 } | 68 } |
67 | 69 |
68 void NativeViewportController::OnDestroyed() { | 70 void NativeViewportController::OnDestroyed() { |
69 base::MessageLoop::current()->Quit(); | 71 base::MessageLoop::current()->Quit(); |
70 } | 72 } |
71 | 73 |
72 void NativeViewportController::SendString(const std::string& string) { | 74 void NativeViewportController::SendString(const std::string& string) { |
73 WriteMessage(pipe_, string.c_str(), string.size()+1, NULL, 0, | 75 DCHECK_LT(string.size() + 1, std::numeric_limits<uint32_t>::max()); |
74 MOJO_WRITE_MESSAGE_FLAG_NONE); | 76 WriteMessage(pipe_, string.c_str(), static_cast<uint32_t>(string.size() + 1), |
| 77 NULL, 0, MOJO_WRITE_MESSAGE_FLAG_NONE); |
75 } | 78 } |
76 | 79 |
77 } // namespace services | 80 } // namespace services |
78 } // namespace mojo | 81 } // namespace mojo |
OLD | NEW |