OLD | NEW |
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/plugins/ppapi/ppb_broker_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/shared_impl/platform_file.h" | 8 #include "ppapi/shared_impl/platform_file.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 return PP_ERROR_FAILED; | 57 return PP_ERROR_FAILED; |
58 | 58 |
59 // The callback must be populated now in case we are connected to the broker | 59 // The callback must be populated now in case we are connected to the broker |
60 // and BrokerConnected is called before ConnectToBroker returns. | 60 // and BrokerConnected is called before ConnectToBroker returns. |
61 // Because it must be created now, it must be aborted and cleared if | 61 // Because it must be created now, it must be aborted and cleared if |
62 // ConnectToBroker fails. | 62 // ConnectToBroker fails. |
63 connect_callback_ = connect_callback; | 63 connect_callback_ = connect_callback; |
64 | 64 |
65 broker_ = plugin_instance->delegate()->ConnectToBroker(this); | 65 broker_ = plugin_instance->delegate()->ConnectToBroker(this); |
66 if (!broker_) { | 66 if (!broker_) { |
67 TrackedCallback::ClearAndAbort(&connect_callback_); | 67 connect_callback_->Abort(); |
68 return PP_ERROR_FAILED; | 68 return PP_ERROR_FAILED; |
69 } | 69 } |
70 | 70 |
71 return PP_OK_COMPLETIONPENDING; | 71 return PP_OK_COMPLETIONPENDING; |
72 } | 72 } |
73 | 73 |
74 int32_t PPB_Broker_Impl::GetHandle(int32_t* handle) { | 74 int32_t PPB_Broker_Impl::GetHandle(int32_t* handle) { |
75 if (pipe_handle_ == PlatformFileToInt(base::kInvalidPlatformFileValue)) | 75 if (pipe_handle_ == PlatformFileToInt(base::kInvalidPlatformFileValue)) |
76 return PP_ERROR_FAILED; // Handle not set yet. | 76 return PP_ERROR_FAILED; // Handle not set yet. |
77 *handle = pipe_handle_; | 77 *handle = pipe_handle_; |
(...skipping 10 matching lines...) Expand all Loading... |
88 DCHECK(pipe_handle_ == | 88 DCHECK(pipe_handle_ == |
89 PlatformFileToInt(base::kInvalidPlatformFileValue)); | 89 PlatformFileToInt(base::kInvalidPlatformFileValue)); |
90 DCHECK(result == PP_OK || | 90 DCHECK(result == PP_OK || |
91 handle == PlatformFileToInt(base::kInvalidPlatformFileValue)); | 91 handle == PlatformFileToInt(base::kInvalidPlatformFileValue)); |
92 | 92 |
93 pipe_handle_ = handle; | 93 pipe_handle_ = handle; |
94 | 94 |
95 // Synchronous calls are not supported. | 95 // Synchronous calls are not supported. |
96 DCHECK(TrackedCallback::IsPending(connect_callback_)); | 96 DCHECK(TrackedCallback::IsPending(connect_callback_)); |
97 | 97 |
98 TrackedCallback::ClearAndRun(&connect_callback_, result); | 98 connect_callback_->Run(result); |
99 } | 99 } |
100 | 100 |
101 } // namespace ppapi | 101 } // namespace ppapi |
102 } // namespace webkit | 102 } // namespace webkit |
OLD | NEW |