OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1438 if (completion_event_for_commit_held_on_tree_activation_ && | 1438 if (completion_event_for_commit_held_on_tree_activation_ && |
1439 !layer_tree_host_impl_->pending_tree()) { | 1439 !layer_tree_host_impl_->pending_tree()) { |
1440 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", | 1440 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", |
1441 TRACE_EVENT_SCOPE_THREAD); | 1441 TRACE_EVENT_SCOPE_THREAD); |
1442 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 1442 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
1443 completion_event_for_commit_held_on_tree_activation_->Signal(); | 1443 completion_event_for_commit_held_on_tree_activation_->Signal(); |
1444 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1444 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1445 } | 1445 } |
1446 } | 1446 } |
1447 | 1447 |
1448 void ThreadProxy::CreateUIResource(UIResourceId uid, | |
aelias_OOO_until_Jul13
2013/07/08 23:40:49
Let's avoid adding these functions by buffering un
powei
2013/07/10 17:47:21
Requests on the main thread can be buffered until
| |
1449 scoped_refptr<UIResourceBitmap> bitmap, | |
1450 bool async) { | |
1451 DCHECK(IsMainThread()); | |
1452 Proxy::ImplThreadTaskRunner()->PostTask( | |
1453 FROM_HERE, | |
1454 base::Bind(&ThreadProxy::CreateUIResourceOnImplThread, | |
1455 impl_thread_weak_ptr_, | |
1456 uid, | |
1457 bitmap, | |
1458 async)); | |
1459 } | |
1460 | |
1461 void ThreadProxy::CreateUIResourceOnImplThread(UIResourceId uid, | |
1462 scoped_refptr<UIResourceBitmap> | |
1463 bitmap, | |
1464 bool async) { | |
1465 DCHECK(IsImplThread()); | |
1466 layer_tree_host_impl_->CreateUIResource(uid, bitmap, async); | |
1467 } | |
1468 | |
1469 void ThreadProxy::DeleteUIResource(UIResourceId uid) { | |
1470 DCHECK(IsMainThread()); | |
1471 Proxy::ImplThreadTaskRunner()->PostTask( | |
1472 FROM_HERE, | |
1473 base::Bind(&ThreadProxy::DeleteUIResourceOnImplThread, | |
1474 impl_thread_weak_ptr_, | |
1475 uid)); | |
1476 } | |
1477 | |
1478 void ThreadProxy::DeleteUIResourceOnImplThread(UIResourceId uid) { | |
1479 DCHECK(IsImplThread()); | |
1480 layer_tree_host_impl_->DeleteUIResource(uid); | |
1481 } | |
1482 | |
1483 void ThreadProxy::UIResourceCreatedOnImplThread(UIResourceId uid) { | |
1484 DCHECK(IsImplThread()); | |
1485 Proxy::MainThreadTaskRunner()->PostTask( | |
1486 FROM_HERE, | |
1487 base::Bind(&ThreadProxy::PostUIResourceCreatedToMainThread, | |
1488 main_thread_weak_ptr_, | |
1489 uid)); | |
1490 // force a redraw here. Pretty sure this is incorrect | |
1491 // scheduler_on_impl_thread_->SetNeedsForcedRedraw(); | |
1492 } | |
1493 | |
1494 void ThreadProxy::UIResourceLostOnImplThread(UIResourceId uid) { | |
1495 DCHECK(IsImplThread()); | |
1496 Proxy::MainThreadTaskRunner()->PostTask( | |
1497 FROM_HERE, | |
1498 base::Bind(&ThreadProxy::PostUIResourceLostToMainThread, | |
1499 main_thread_weak_ptr_, | |
1500 uid)); | |
1501 } | |
1502 | |
1503 void ThreadProxy::PostUIResourceCreatedToMainThread(UIResourceId uid) { | |
1504 DCHECK(IsMainThread()); | |
1505 layer_tree_host_->UIResourceReady(uid); | |
1506 } | |
1507 | |
1508 void ThreadProxy::PostUIResourceLostToMainThread(UIResourceId uid) { | |
1509 DCHECK(IsMainThread()); | |
1510 layer_tree_host_->UIResourceLost(uid); | |
1511 } | |
1512 | |
1448 } // namespace cc | 1513 } // namespace cc |
OLD | NEW |