OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ppapi/proxy/url_loader_resource.h" | 5 #include "ppapi/proxy/url_loader_resource.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/c/pp_completion_callback.h" | 8 #include "ppapi/c/pp_completion_callback.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/c/ppb_url_loader.h" | 10 #include "ppapi/c/ppb_url_loader.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 bytes_sent_, total_bytes_to_be_sent_, | 318 bytes_sent_, total_bytes_to_be_sent_, |
319 bytes_received_, total_bytes_to_be_received_); | 319 bytes_received_, total_bytes_to_be_received_); |
320 } | 320 } |
321 | 321 |
322 void URLLoaderResource::SetDefersLoading(bool defers_loading) { | 322 void URLLoaderResource::SetDefersLoading(bool defers_loading) { |
323 Post(RENDERER, PpapiHostMsg_URLLoader_SetDeferLoading(defers_loading)); | 323 Post(RENDERER, PpapiHostMsg_URLLoader_SetDeferLoading(defers_loading)); |
324 } | 324 } |
325 | 325 |
326 int32_t URLLoaderResource::ValidateCallback( | 326 int32_t URLLoaderResource::ValidateCallback( |
327 scoped_refptr<TrackedCallback> callback) { | 327 scoped_refptr<TrackedCallback> callback) { |
328 DCHECK(callback); | 328 DCHECK(callback.get()); |
329 if (TrackedCallback::IsPending(pending_callback_)) | 329 if (TrackedCallback::IsPending(pending_callback_)) |
330 return PP_ERROR_INPROGRESS; | 330 return PP_ERROR_INPROGRESS; |
331 return PP_OK; | 331 return PP_OK; |
332 } | 332 } |
333 | 333 |
334 void URLLoaderResource::RegisterCallback( | 334 void URLLoaderResource::RegisterCallback( |
335 scoped_refptr<TrackedCallback> callback) { | 335 scoped_refptr<TrackedCallback> callback) { |
336 DCHECK(!TrackedCallback::IsPending(pending_callback_)); | 336 DCHECK(!TrackedCallback::IsPending(pending_callback_)); |
337 pending_callback_ = callback; | 337 pending_callback_ = callback; |
338 } | 338 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 } | 383 } |
384 | 384 |
385 // Reset for next time. | 385 // Reset for next time. |
386 user_buffer_ = NULL; | 386 user_buffer_ = NULL; |
387 user_buffer_size_ = 0; | 387 user_buffer_size_ = 0; |
388 return bytes_to_copy; | 388 return bytes_to_copy; |
389 } | 389 } |
390 | 390 |
391 } // namespace proxy | 391 } // namespace proxy |
392 } // namespace ppapi | 392 } // namespace ppapi |
OLD | NEW |